Advertisement
tensador125

l2j DressMe aCis 372

Apr 15th, 2023 (edited)
1,773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 105.23 KB | Gaming | 0 0
  1. diff --git server/gameserver/data/html/dressme/allskins.htm server/gameserver/data/html/dressme/allskins.htm
  2. new file mode 100644
  3. index 0000000..f46a2bd
  4. --- /dev/null
  5. +++ server/gameserver/data/html/dressme/allskins.htm
  6. @@ -0,0 +1,20 @@
  7. +<html>
  8. +<body>
  9. +<img src="L2UI.Squaregray" width="300" height="1">
  10. +<table width=300 border=0 cellspacing=0 cellpadding=1 bgcolor=000000 height=15>
  11. +<tr>
  12. +<td width=36 align=center></td>
  13. +<td width=120 align=left>Name</td>
  14. +<td width=65 align=left>Actions</td>
  15. +</tr>
  16. +</table>
  17. +<img src="L2UI.Squaregray" width="300" height="1">
  18. +
  19. +%showList%
  20. +
  21. +<center>
  22. +<button value="Back" action="bypass -h custom_dressme_back" width=65 height=19 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2">
  23. +</center>
  24. +
  25. +</body>
  26. +</html>
  27. \ No newline at end of file
  28. diff --git server/gameserver/data/html/dressme/index.htm server/gameserver/data/html/dressme/index.htm
  29. new file mode 100644
  30. index 0000000..1175fed
  31. --- /dev/null
  32. +++ server/gameserver/data/html/dressme/index.htm
  33. @@ -0,0 +1,26 @@
  34. +<html>
  35. +<title>Skins Shop</title>
  36. +<body>
  37. +<br>
  38. +<center>Skins:</center>
  39. +
  40. +<table width=300>
  41. +<tr>
  42. +<td align=center><button value="Armor buy/try" action="bypass -h dressme 1 skinlist armor" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  43. +</tr>
  44. +<tr>
  45. +<td align=center><button value="Weapon buy/try" action="bypass -h dressme 1 skinlist weapon" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  46. +</tr>
  47. +<tr>
  48. +<td align=center><button value="Hair buy/try" action="bypass -h dressme 1 skinlist hair" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  49. +</tr>
  50. +<tr>
  51. +<td align=center><button value="Face buy/try" action="bypass -h dressme 1 skinlist face" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  52. +</tr>
  53. +<tr>
  54. +<td align=center><button value="Shield buy/try" action="bypass -h dressme 1 skinlist shield" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  55. +</tr>
  56. +<tr>
  57. +<td align=center><button value="My skins" action="bypass -h dressme 1 myskinlist" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td>
  58. +</tr>
  59. +</table>
  60. +
  61. +</body>
  62. +</html>
  63. \ No newline at end of file
  64. diff --git server/gameserver/data/html/dressme/myskins.htm server/gameserver/data/html/dressme/myskins.htm
  65. new file mode 100644
  66. index 0000000..381164c
  67. --- /dev/null
  68. +++ server/gameserver/data/html/dressme/myskins.htm
  69. @@ -0,0 +1,21 @@
  70. +<html>
  71. +<body>
  72. +<img src="L2UI.Squaregray" width="300" height="1">
  73. +<table border=0 cellspacing=0 cellpadding=2 bgcolor=000000 height=20>
  74. +<tr>
  75. +<td width=32 align=center></td>
  76. +<td width=203 align=left>Name</td>
  77. +<td width=65 align=left>Actions</td>
  78. +</tr>
  79. +</table>
  80. +<img src="L2UI.Squaregray" width="300" height="1">
  81. +
  82. +%showList%
  83. +
  84. +<br>
  85. +<br>
  86. +<center>
  87. +<button value="Back" action="bypass -h custom_dressme_back" width=65 height=19 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal">
  88. +</center>
  89. +</body>
  90. +</html>
  91. \ No newline at end of file
  92. diff --git server/gameserver/data/xml/dressme.xml server/gameserver/data/xml/dressme.xml
  93. new file mode 100644
  94. index 0000000..b8c5ef5
  95. --- /dev/null
  96. +++ server/gameserver/data/xml/dressme.xml
  97. @@ -0,0 +1,18 @@
  98. +<?xml version="1.0" encoding="UTF-8"?>
  99. +<list>
  100. +   <skin type="armor"> <!-- Armors -->
  101. +       <type id="1" name="Draconic Armor" chestId="6379" legsId="0" glovesId="6380" feetId="6381" priceId="57" priceCount="100"/>
  102. +       <type id="2" name="Blue Wolf Leather Armor" chestId="2391" legsId="0" glovesId="0" feetId="0" priceId="57" priceCount="100"/>
  103. +   </skin>
  104. +   <skin type="weapon"> <!-- Weapons -->
  105. +       <type id="1" name="Draconic Bow" weaponId="7575" priceId="57" priceCount="100"/>
  106. +       <type id="2" name="Arcana Mace" weaponId="6608"  priceId="57" priceCount="100"/>
  107. +       <type id="3" name="Keshanberk*Keshanberk" weaponId="5704" priceId="57" priceCount="100"/>
  108. +   </skin>
  109. +   <skin type="hair"> <!-- Hairs -->
  110. +       <type id="1" name="Cat Ear" hairId="6843" priceId="57" priceCount="100"/>
  111. +   </skin>
  112. +   <skin type="face"> <!-- Faces -->
  113. +       <type id="1" name="Party Mask" faceId="5808" priceId="57" priceCount="100"/>
  114. +   </skin>
  115. +   <skin type="shield"> <!-- Shields -->
  116. +       <type id="1" name="Shield of Night" shieldId="2498" priceId="57" priceCount="100"/>
  117. +       <type id="2" name="Imperial Shield" shieldId="6377" priceId="57" priceCount="100"/>
  118. +   </skin>
  119. +</list>
  120. \ No newline at end of file
  121. diff --git server/gameserver/config/players.properties server/gameserver/config/players.properties
  122. index a3e8e08..c1da93b 100644
  123. --- server/gameserver/config/players.properties
  124. +++ server/gameserver/config/players.properties
  125. @@ -14,6 +14,22 @@
  126.  MpRegenMultiplier = 1.
  127.  CpRegenMultiplier = 1.
  128.  
  129. +
  130. +# DressMe system.
  131. +AllowDressMeSystem = True
  132. +
  133. +# DressMe Command
  134. +DressMeCommand = dressme
  135. +
  136. +# Only for premium account
  137. +AllowDressMeForPremiumOnly = True
  138. +
  139. +
  140. +# Players won't see the skins in Olympiad
  141. +AllowDressMeInOly = True
  142. +
  143. +
  144. +
  145.  
  146.  
  147. diff --git java/Base/Skin/DressMeData.java java/Base/Skin/DressMeData.java
  148. new file mode 100644
  149. index 0000000..5237d53
  150. --- /dev/null
  151. +++ java/Base/Skin/DressMeData.java
  152. @@ -0,0 +1,216 @@
  153. +package Base.Skin;
  154. +
  155. +import java.util.HashMap;
  156. +import java.util.Map;
  157. +import java.util.logging.Logger;
  158. +
  159. +import net.sf.l2j.gameserver.templates.StatsSet;
  160. +
  161. +import org.w3c.dom.Document;
  162. +import org.w3c.dom.NamedNodeMap;
  163. +import org.w3c.dom.Node;
  164. +
  165. +import Base.Xml.IXmlReader;
  166. +
  167. +
  168. +
  169. +public class DressMeData implements IXmlReader
  170. +{
  171. +   private static final Logger LOG = Logger.getLogger(DressMeData.class.getName());
  172. +  
  173. +   private final static Map<Integer, SkinPackage> _armorSkins = new HashMap<>();
  174. +   private final static Map<Integer, SkinPackage> _weaponSkins = new HashMap<>();
  175. +   private final static Map<Integer, SkinPackage> _hairSkins = new HashMap<>();
  176. +   private final static Map<Integer, SkinPackage> _faceSkins = new HashMap<>();
  177. +   private final static Map<Integer, SkinPackage> _shieldSkins = new HashMap<>();
  178. +  
  179. +   public DressMeData()
  180. +   {
  181. +       load();
  182. +   }
  183. +  
  184. +   public void reload()
  185. +   {
  186. +       _armorSkins.clear();
  187. +       _weaponSkins.clear();
  188. +       _hairSkins.clear();
  189. +       _faceSkins.clear();
  190. +       _shieldSkins.clear();
  191. +      
  192. +       load();
  193. +   }
  194. +  
  195. +   @Override
  196. +   public void load()
  197. +   {
  198. +       parseDatapackFile("./data/xml/dressme.xml");
  199. +       LOG.info(getClass().getSimpleName() + ": Loaded " + _armorSkins.size() + " armor skins");
  200. +       LOG.info(getClass().getSimpleName() + ": Loaded " + _weaponSkins.size() + " weapon skins");
  201. +       LOG.info(getClass().getSimpleName() + ": Loaded " + _hairSkins.size() + " hair skins");
  202. +       LOG.info(getClass().getSimpleName() + ": Loaded " + _faceSkins.size() + " face skins");
  203. +       LOG.info(getClass().getSimpleName() + ": Loaded " + _shieldSkins.size() + " shield skins");
  204. +   }
  205. +  
  206. +   @Override
  207. +   public void parseDocument(Document doc)
  208. +   {
  209. +       for (Node list = doc.getFirstChild(); list != null; list = list.getNextSibling())
  210. +       {
  211. +           if ("list".equalsIgnoreCase(list.getNodeName()))
  212. +           {
  213. +               for (Node skin = list.getFirstChild(); skin != null; skin = skin.getNextSibling())
  214. +               {
  215. +                   if ("skin".equalsIgnoreCase(skin.getNodeName()))
  216. +                   {
  217. +                       final NamedNodeMap attrs = skin.getAttributes();
  218. +                      
  219. +                       String type = parseString(attrs, "type");
  220. +                      
  221. +                       final StatsSet set = new StatsSet();
  222. +                      
  223. +                       for (Node typeN = skin.getFirstChild(); typeN != null; typeN = typeN.getNextSibling())
  224. +                       {
  225. +                           if ("type".equalsIgnoreCase(typeN.getNodeName()))
  226. +                           {
  227. +                               final NamedNodeMap attrs2 = typeN.getAttributes();
  228. +                              
  229. +                               int id = parseInteger(attrs2, "id");
  230. +                               String name = parseString(attrs2, "name");
  231. +                               int weaponId = parseInteger(attrs2, "weaponId", 0);
  232. +                               int shieldId = parseInteger(attrs2, "shieldId", 0);
  233. +                               int chestId = parseInteger(attrs2, "chestId", 0);
  234. +                               int hairId = parseInteger(attrs2, "hairId", 0);
  235. +                               int faceId = parseInteger(attrs2, "faceId", 0);
  236. +                               int legsId = parseInteger(attrs2, "legsId", 0);
  237. +                               int glovesId = parseInteger(attrs2, "glovesId", 0);
  238. +                               int feetId = parseInteger(attrs2, "feetId", 0);
  239. +                               int priceId = parseInteger(attrs2, "priceId", 0);
  240. +                               int priceCount = parseInteger(attrs2, "priceCount", 0);
  241. +                              
  242. +                               set.set("type", type);
  243. +                              
  244. +                               set.set("id", id);
  245. +                               set.set("name", name);
  246. +                               set.set("weaponId", weaponId);
  247. +                               set.set("shieldId", shieldId);
  248. +                               set.set("chestId", chestId);
  249. +                               set.set("hairId", hairId);
  250. +                               set.set("faceId", faceId);
  251. +                               set.set("legsId", legsId);
  252. +                               set.set("glovesId", glovesId);
  253. +                               set.set("feetId", feetId);
  254. +                               set.set("priceId", priceId);
  255. +                               set.set("priceCount", priceCount);
  256. +                              
  257. +                               switch (type.toLowerCase())
  258. +                               {
  259. +                                   case "armor":
  260. +                                       _armorSkins.put(id, new SkinPackage(set));
  261. +                                       break;
  262. +                                   case "weapon":
  263. +                                       _weaponSkins.put(id, new SkinPackage(set));
  264. +                                       break;
  265. +                                   case "hair":
  266. +                                       _hairSkins.put(id, new SkinPackage(set));
  267. +                                       break;
  268. +                                   case "face":
  269. +                                       _faceSkins.put(id, new SkinPackage(set));
  270. +                                       break;
  271. +                                   case "shield":
  272. +                                       _shieldSkins.put(id, new SkinPackage(set));
  273. +                                       break;
  274. +                               }
  275. +                           }
  276. +                       }
  277. +                   }
  278. +               }
  279. +           }
  280. +       }
  281. +      
  282. +   }
  283. +  
  284. +   public SkinPackage getArmorSkinsPackage(int id)
  285. +   {
  286. +       if (!_armorSkins.containsKey(id))
  287. +       {
  288. +           return null;
  289. +       }
  290. +      
  291. +       return _armorSkins.get(id);
  292. +   }
  293. +  
  294. +   public Map<Integer, SkinPackage> getArmorSkinOptions()
  295. +   {
  296. +       return _armorSkins;
  297. +   }
  298. +  
  299. +   public SkinPackage getWeaponSkinsPackage(int id)
  300. +   {
  301. +       if (!_weaponSkins.containsKey(id))
  302. +       {
  303. +           return null;
  304. +       }
  305. +      
  306. +       return _weaponSkins.get(id);
  307. +   }
  308. +  
  309. +   public Map<Integer, SkinPackage> getWeaponSkinOptions()
  310. +   {
  311. +       return _weaponSkins;
  312. +   }
  313. +  
  314. +   public SkinPackage getHairSkinsPackage(int id)
  315. +   {
  316. +       if (!_hairSkins.containsKey(id))
  317. +       {
  318. +           return null;
  319. +       }
  320. +      
  321. +       return _hairSkins.get(id);
  322. +   }
  323. +  
  324. +   public Map<Integer, SkinPackage> getHairSkinOptions()
  325. +   {
  326. +       return _hairSkins;
  327. +   }
  328. +  
  329. +   public SkinPackage getFaceSkinsPackage(int id)
  330. +   {
  331. +       if (!_faceSkins.containsKey(id))
  332. +       {
  333. +           return null;
  334. +       }
  335. +      
  336. +       return _faceSkins.get(id);
  337. +   }
  338. +  
  339. +   public Map<Integer, SkinPackage> getFaceSkinOptions()
  340. +   {
  341. +       return _faceSkins;
  342. +   }
  343. +  
  344. +   public SkinPackage getShieldSkinsPackage(int id)
  345. +   {
  346. +       if (!_shieldSkins.containsKey(id))
  347. +       {
  348. +           return null;
  349. +       }
  350. +      
  351. +       return _shieldSkins.get(id);
  352. +   }
  353. +  
  354. +   public Map<Integer, SkinPackage> getShieldSkinOptions()
  355. +   {
  356. +       return _shieldSkins;
  357. +   }
  358. +  
  359. +   public static DressMeData getInstance()
  360. +   {
  361. +       return SingletonHolder._instance;
  362. +   }
  363. +  
  364. +   private static class SingletonHolder
  365. +   {
  366. +       protected static final DressMeData _instance = new DressMeData();
  367. +   }
  368. +}
  369. \ No newline at end of file
  370. diff --git java/Base/Skin/SkinPackage.java java/Base/Skin/SkinPackage.java
  371. new file mode 100644
  372. index 0000000..9d32fda
  373. --- /dev/null
  374. +++ java/Base/Skin/SkinPackage.java
  375. @@ -0,0 +1,102 @@
  376. +package Base.Skin;
  377. +
  378. +import net.sf.l2j.gameserver.templates.StatsSet;
  379. +
  380. +public class SkinPackage
  381. +{
  382. +   private String _type;
  383. +   private String _name;
  384. +   private int _id;
  385. +   private int _weaponId;
  386. +   private int _shieldId;
  387. +   private int _chestId;
  388. +   private int _hairId;
  389. +   private int _faceId;
  390. +   private int _legsId;
  391. +   private int _glovesId;
  392. +   private int _feetId;
  393. +   private int _priceId;
  394. +   private int _priceCount;
  395. +  
  396. +   public SkinPackage(StatsSet set)
  397. +   {
  398. +       _type = set.getString("type", "default");
  399. +       _name = set.getString("name", "NoName");
  400. +       _id = set.getInteger("id", 0);
  401. +       _weaponId = set.getInteger("weaponId", 0);
  402. +       _shieldId = set.getInteger("shieldId", 0);
  403. +       _chestId = set.getInteger("chestId", 0);
  404. +       _hairId = set.getInteger("hairId", 0);
  405. +       _faceId = set.getInteger("faceId", 0);
  406. +       _legsId = set.getInteger("legsId", 0);
  407. +       _glovesId = set.getInteger("glovesId", 0);
  408. +       _feetId = set.getInteger("feetId", 0);
  409. +       _priceId = set.getInteger("priceId", 0);
  410. +       _priceCount = set.getInteger("priceCount", 0);
  411. +   }
  412. +  
  413. +   public int getId()
  414. +   {
  415. +       return _id;
  416. +   }
  417. +  
  418. +   public String getType()
  419. +   {
  420. +       return _type;
  421. +   }
  422. +  
  423. +   public String getName()
  424. +   {
  425. +       return _name;
  426. +   }
  427. +  
  428. +   public int getWeaponId()
  429. +   {
  430. +       return _weaponId;
  431. +   }
  432. +  
  433. +   public int getShieldId()
  434. +   {
  435. +       return _shieldId;
  436. +   }
  437. +  
  438. +   public int getChestId()
  439. +   {
  440. +       return _chestId;
  441. +   }
  442. +  
  443. +   public int getHairId()
  444. +   {
  445. +       return _hairId;
  446. +   }
  447. +  
  448. +   public int getFaceId()
  449. +   {
  450. +       return _faceId;
  451. +   }
  452. +  
  453. +   public int getLegsId()
  454. +   {
  455. +       return _legsId;
  456. +   }
  457. +  
  458. +   public int getGlovesId()
  459. +   {
  460. +       return _glovesId;
  461. +   }
  462. +  
  463. +   public int getFeetId()
  464. +   {
  465. +       return _feetId;
  466. +   }
  467. +  
  468. +   public int getPriceId()
  469. +   {
  470. +       return _priceId;
  471. +   }
  472. +  
  473. +   public int getPriceCount()
  474. +   {
  475. +       return _priceCount;
  476. +   }
  477. +}
  478. \ No newline at end of file
  479. diff --git java/Base/Xml/IXmlReader.java java/Base/Xml/IXmlReader.java
  480. new file mode 100644
  481. index 0000000..f6959f7
  482. --- /dev/null
  483. +++ java/Base/Xml/IXmlReader.java
  484. @@ -0,0 +1,575 @@
  485. +
  486. +package Base.Xml;
  487. +
  488. +import java.io.File;
  489. +import java.io.FileFilter;
  490. +import java.util.logging.Logger;
  491. +
  492. +import javax.xml.parsers.DocumentBuilder;
  493. +import javax.xml.parsers.DocumentBuilderFactory;
  494. +
  495. +import net.sf.l2j.gameserver.GameServer;
  496. +import net.sf.l2j.gameserver.templates.StatsSet;
  497. +
  498. +import org.w3c.dom.Document;
  499. +import org.w3c.dom.NamedNodeMap;
  500. +import org.w3c.dom.Node;
  501. +import org.xml.sax.ErrorHandler;
  502. +import org.xml.sax.SAXParseException;
  503. +
  504. +
  505. +
  506. +public interface IXmlReader
  507. +{
  508. +   static final Logger LOG = Logger.getLogger(GameServer.class.getName());
  509. +  
  510. +   static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
  511. +   static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
  512. +  
  513. +   static final XMLFilter XML_FILTER = new XMLFilter();
  514. +  
  515. +   public void load();
  516. +  
  517. +   default void parseDatapackFile(String path)
  518. +   {
  519. +       parseFile(new File(".", path));
  520. +   }
  521. +  
  522. +   default void parseFile(File f)
  523. +   {
  524. +       if (!getCurrentFileFilter().accept(f))
  525. +       {
  526. +           LOG.warning("{}: Could not parse {} is not a file or it doesn't exist!");
  527. +           return;
  528. +       }
  529. +      
  530. +       final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  531. +       dbf.setNamespaceAware(true);
  532. +       dbf.setValidating(false);
  533. +       dbf.setIgnoringComments(true);
  534. +      
  535. +       try
  536. +       {
  537. +           dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
  538. +           final DocumentBuilder db = dbf.newDocumentBuilder();
  539. +           db.setErrorHandler(new XMLErrorHandler());
  540. +           parseDocument(db.parse(f), f);
  541. +       }
  542. +       catch (SAXParseException e)
  543. +       {
  544. +           LOG.warning("{}: Could not parse file {} at line {}, column {}");
  545. +           return;
  546. +       }
  547. +       catch (Exception e)
  548. +       {
  549. +           LOG.warning("{}: Could not parse file {}");
  550. +           return;
  551. +       }
  552. +   }
  553. +  
  554. +   default boolean parseDirectory(File file)
  555. +   {
  556. +       return parseDirectory(file, false);
  557. +   }
  558. +  
  559. +   default boolean parseDirectory(String path)
  560. +   {
  561. +       return parseDirectory(new File(path), false);
  562. +   }
  563. +  
  564. +   default boolean parseDirectory(String path, boolean recursive)
  565. +   {
  566. +       return parseDirectory(new File(path), recursive);
  567. +   }
  568. +  
  569. +   default boolean parseDirectory(File dir, boolean recursive)
  570. +   {
  571. +       if (!dir.exists())
  572. +       {
  573. +           LOG.warning("{}: Folder {} doesn't exist!");
  574. +           return false;
  575. +       }
  576. +      
  577. +       final File[] files = dir.listFiles();
  578. +       if (files != null)
  579. +       {
  580. +           for (File f : files)
  581. +           {
  582. +               if (recursive && f.isDirectory())
  583. +               {
  584. +                   parseDirectory(f, recursive);
  585. +               }
  586. +               else if (getCurrentFileFilter().accept(f))
  587. +               {
  588. +                   parseFile(f);
  589. +               }
  590. +           }
  591. +       }
  592. +       return true;
  593. +   }
  594. +  
  595. +   default boolean parseDatapackDirectory(String path, boolean recursive)
  596. +   {
  597. +       return parseDirectory(new File(".", path), recursive);
  598. +   }
  599. +  
  600. +   default void parseDocument(Document doc, File f)
  601. +   {
  602. +       parseDocument(doc);
  603. +   }
  604. +  
  605. +   default void parseDocument(Document doc)
  606. +   {
  607. +       LOG.warning("{}: Parser not implemented!");
  608. +   }
  609. +  
  610. +   default Boolean parseBoolean(Node node, Boolean defaultValue)
  611. +   {
  612. +       return node != null ? Boolean.valueOf(node.getNodeValue()) : defaultValue;
  613. +   }
  614. +  
  615. +   default Boolean parseBoolean(Node node)
  616. +   {
  617. +       return parseBoolean(node, null);
  618. +   }
  619. +  
  620. +   default Boolean parseBoolean(NamedNodeMap attrs, String name)
  621. +   {
  622. +       return parseBoolean(attrs.getNamedItem(name));
  623. +   }
  624. +  
  625. +   default Boolean parseBoolean(NamedNodeMap attrs, String name, Boolean defaultValue)
  626. +   {
  627. +       return parseBoolean(attrs.getNamedItem(name), defaultValue);
  628. +   }
  629. +  
  630. +   default Byte parseByte(Node node, Byte defaultValue)
  631. +   {
  632. +       return node != null ? Byte.valueOf(node.getNodeValue()) : defaultValue;
  633. +   }
  634. +  
  635. +   default StatsSet parseAttributes(Node node)
  636. +   {
  637. +       final NamedNodeMap attrs = node.getAttributes();
  638. +       final StatsSet map = new StatsSet();
  639. +       for (int i = 0; i < attrs.getLength(); i++)
  640. +       {
  641. +           final Node att = attrs.item(i);
  642. +           map.set(att.getNodeName(), att.getNodeValue());
  643. +       }
  644. +       return map;
  645. +   }
  646. +  
  647. +   /**
  648. +    * Parses a byte value.
  649. +    * @param node the node to parse
  650. +    * @return if the node is not null, the value of the parsed node, otherwise null
  651. +    */
  652. +   default Byte parseByte(Node node)
  653. +   {
  654. +       return parseByte(node, null);
  655. +   }
  656. +  
  657. +   /**
  658. +    * Parses a byte value.
  659. +    * @param attrs the attributes
  660. +    * @param name the name of the attribute to parse
  661. +    * @return if the node is not null, the value of the parsed node, otherwise null
  662. +    */
  663. +   default Byte parseByte(NamedNodeMap attrs, String name)
  664. +   {
  665. +       return parseByte(attrs.getNamedItem(name));
  666. +   }
  667. +  
  668. +   /**
  669. +    * Parses a byte value.
  670. +    * @param attrs the attributes
  671. +    * @param name the name of the attribute to parse
  672. +    * @param defaultValue the default value
  673. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  674. +    */
  675. +   default Byte parseByte(NamedNodeMap attrs, String name, Byte defaultValue)
  676. +   {
  677. +       return parseByte(attrs.getNamedItem(name), defaultValue);
  678. +   }
  679. +  
  680. +   /**
  681. +    * Parses a short value.
  682. +    * @param node the node to parse
  683. +    * @param defaultValue the default value
  684. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  685. +    */
  686. +   default Short parseShort(Node node, Short defaultValue)
  687. +   {
  688. +       return node != null ? Short.valueOf(node.getNodeValue()) : defaultValue;
  689. +   }
  690. +  
  691. +   /**
  692. +    * Parses a short value.
  693. +    * @param node the node to parse
  694. +    * @return if the node is not null, the value of the parsed node, otherwise null
  695. +    */
  696. +   default Short parseShort(Node node)
  697. +   {
  698. +       return parseShort(node, null);
  699. +   }
  700. +  
  701. +   /**
  702. +    * Parses a short value.
  703. +    * @param attrs the attributes
  704. +    * @param name the name of the attribute to parse
  705. +    * @return if the node is not null, the value of the parsed node, otherwise null
  706. +    */
  707. +   default Short parseShort(NamedNodeMap attrs, String name)
  708. +   {
  709. +       return parseShort(attrs.getNamedItem(name));
  710. +   }
  711. +  
  712. +   /**
  713. +    * Parses a short value.
  714. +    * @param attrs the attributes
  715. +    * @param name the name of the attribute to parse
  716. +    * @param defaultValue the default value
  717. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  718. +    */
  719. +   default Short parseShort(NamedNodeMap attrs, String name, Short defaultValue)
  720. +   {
  721. +       return parseShort(attrs.getNamedItem(name), defaultValue);
  722. +   }
  723. +  
  724. +   /**
  725. +    * Parses an int value.
  726. +    * @param node the node to parse
  727. +    * @param defaultValue the default value
  728. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  729. +    */
  730. +   default int parseInt(Node node, Integer defaultValue)
  731. +   {
  732. +       return node != null ? Integer.parseInt(node.getNodeValue()) : defaultValue;
  733. +   }
  734. +  
  735. +   /**
  736. +    * Parses an int value.
  737. +    * @param node the node to parse
  738. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  739. +    */
  740. +   default int parseInt(Node node)
  741. +   {
  742. +       return parseInt(node, -1);
  743. +   }
  744. +  
  745. +   /**
  746. +    * Parses an integer value.
  747. +    * @param node the node to parse
  748. +    * @param defaultValue the default value
  749. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  750. +    */
  751. +   default Integer parseInteger(Node node, Integer defaultValue)
  752. +   {
  753. +       return node != null ? Integer.valueOf(node.getNodeValue()) : defaultValue;
  754. +   }
  755. +  
  756. +   /**
  757. +    * Parses an integer value.
  758. +    * @param node the node to parse
  759. +    * @return if the node is not null, the value of the parsed node, otherwise null
  760. +    */
  761. +   default Integer parseInteger(Node node)
  762. +   {
  763. +       return parseInteger(node, null);
  764. +   }
  765. +  
  766. +   /**
  767. +    * Parses an integer value.
  768. +    * @param attrs the attributes
  769. +    * @param name the name of the attribute to parse
  770. +    * @return if the node is not null, the value of the parsed node, otherwise null
  771. +    */
  772. +   default Integer parseInteger(NamedNodeMap attrs, String name)
  773. +   {
  774. +       return parseInteger(attrs.getNamedItem(name));
  775. +   }
  776. +  
  777. +   /**
  778. +    * Parses an integer value.
  779. +    * @param attrs the attributes
  780. +    * @param name the name of the attribute to parse
  781. +    * @param defaultValue the default value
  782. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  783. +    */
  784. +   default Integer parseInteger(NamedNodeMap attrs, String name, Integer defaultValue)
  785. +   {
  786. +       return parseInteger(attrs.getNamedItem(name), defaultValue);
  787. +   }
  788. +  
  789. +   /**
  790. +    * Parses a long value.
  791. +    * @param node the node to parse
  792. +    * @param defaultValue the default value
  793. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  794. +    */
  795. +   default Long parseLong(Node node, Long defaultValue)
  796. +   {
  797. +       return node != null ? Long.valueOf(node.getNodeValue()) : defaultValue;
  798. +   }
  799. +  
  800. +   /**
  801. +    * Parses a long value.
  802. +    * @param node the node to parse
  803. +    * @return if the node is not null, the value of the parsed node, otherwise null
  804. +    */
  805. +   default Long parseLong(Node node)
  806. +   {
  807. +       return parseLong(node, null);
  808. +   }
  809. +  
  810. +   /**
  811. +    * Parses a long value.
  812. +    * @param attrs the attributes
  813. +    * @param name the name of the attribute to parse
  814. +    * @return if the node is not null, the value of the parsed node, otherwise null
  815. +    */
  816. +   default Long parseLong(NamedNodeMap attrs, String name)
  817. +   {
  818. +       return parseLong(attrs.getNamedItem(name));
  819. +   }
  820. +  
  821. +   /**
  822. +    * Parses a long value.
  823. +    * @param attrs the attributes
  824. +    * @param name the name of the attribute to parse
  825. +    * @param defaultValue the default value
  826. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  827. +    */
  828. +   default Long parseLong(NamedNodeMap attrs, String name, Long defaultValue)
  829. +   {
  830. +       return parseLong(attrs.getNamedItem(name), defaultValue);
  831. +   }
  832. +  
  833. +   /**
  834. +    * Parses a float value.
  835. +    * @param node the node to parse
  836. +    * @param defaultValue the default value
  837. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  838. +    */
  839. +   default Float parseFloat(Node node, Float defaultValue)
  840. +   {
  841. +       return node != null ? Float.valueOf(node.getNodeValue()) : defaultValue;
  842. +   }
  843. +  
  844. +   /**
  845. +    * Parses a float value.
  846. +    * @param node the node to parse
  847. +    * @return if the node is not null, the value of the parsed node, otherwise null
  848. +    */
  849. +   default Float parseFloat(Node node)
  850. +   {
  851. +       return parseFloat(node, null);
  852. +   }
  853. +  
  854. +   /**
  855. +    * Parses a float value.
  856. +    * @param attrs the attributes
  857. +    * @param name the name of the attribute to parse
  858. +    * @return if the node is not null, the value of the parsed node, otherwise null
  859. +    */
  860. +   default Float parseFloat(NamedNodeMap attrs, String name)
  861. +   {
  862. +       return parseFloat(attrs.getNamedItem(name));
  863. +   }
  864. +  
  865. +   /**
  866. +    * Parses a float value.
  867. +    * @param attrs the attributes
  868. +    * @param name the name of the attribute to parse
  869. +    * @param defaultValue the default value
  870. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  871. +    */
  872. +   default Float parseFloat(NamedNodeMap attrs, String name, Float defaultValue)
  873. +   {
  874. +       return parseFloat(attrs.getNamedItem(name), defaultValue);
  875. +   }
  876. +  
  877. +   /**
  878. +    * Parses a double value.
  879. +    * @param node the node to parse
  880. +    * @param defaultValue the default value
  881. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  882. +    */
  883. +   default Double parseDouble(Node node, Double defaultValue)
  884. +   {
  885. +       return node != null ? Double.valueOf(node.getNodeValue()) : defaultValue;
  886. +   }
  887. +  
  888. +   /**
  889. +    * Parses a double value.
  890. +    * @param node the node to parse
  891. +    * @return if the node is not null, the value of the parsed node, otherwise null
  892. +    */
  893. +   default Double parseDouble(Node node)
  894. +   {
  895. +       return parseDouble(node, null);
  896. +   }
  897. +  
  898. +   /**
  899. +    * Parses a double value.
  900. +    * @param attrs the attributes
  901. +    * @param name the name of the attribute to parse
  902. +    * @return if the node is not null, the value of the parsed node, otherwise null
  903. +    */
  904. +   default Double parseDouble(NamedNodeMap attrs, String name)
  905. +   {
  906. +       return parseDouble(attrs.getNamedItem(name));
  907. +   }
  908. +  
  909. +   /**
  910. +    * Parses a double value.
  911. +    * @param attrs the attributes
  912. +    * @param name the name of the attribute to parse
  913. +    * @param defaultValue the default value
  914. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  915. +    */
  916. +   default Double parseDouble(NamedNodeMap attrs, String name, Double defaultValue)
  917. +   {
  918. +       return parseDouble(attrs.getNamedItem(name), defaultValue);
  919. +   }
  920. +  
  921. +   /**
  922. +    * Parses a string value.
  923. +    * @param node the node to parse
  924. +    * @param defaultValue the default value
  925. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  926. +    */
  927. +   default String parseString(Node node, String defaultValue)
  928. +   {
  929. +       return node != null ? node.getNodeValue() : defaultValue;
  930. +   }
  931. +  
  932. +   /**
  933. +    * Parses a string value.
  934. +    * @param node the node to parse
  935. +    * @return if the node is not null, the value of the parsed node, otherwise null
  936. +    */
  937. +   default String parseString(Node node)
  938. +   {
  939. +       return parseString(node, null);
  940. +   }
  941. +  
  942. +   /**
  943. +    * Parses a string value.
  944. +    * @param attrs the attributes
  945. +    * @param name the name of the attribute to parse
  946. +    * @return if the node is not null, the value of the parsed node, otherwise null
  947. +    */
  948. +   default String parseString(NamedNodeMap attrs, String name)
  949. +   {
  950. +       return parseString(attrs.getNamedItem(name));
  951. +   }
  952. +  
  953. +   /**
  954. +    * Parses a string value.
  955. +    * @param attrs the attributes
  956. +    * @param name the name of the attribute to parse
  957. +    * @param defaultValue the default value
  958. +    * @return if the node is not null, the value of the parsed node, otherwise the default value
  959. +    */
  960. +   default String parseString(NamedNodeMap attrs, String name, String defaultValue)
  961. +   {
  962. +       return parseString(attrs.getNamedItem(name), defaultValue);
  963. +   }
  964. +  
  965. +   /**
  966. +    * Parses an enumerated value.
  967. +    * @param <T> the enumerated type
  968. +    * @param node the node to parse
  969. +    * @param clazz the class of the enumerated
  970. +    * @param defaultValue the default value
  971. +    * @return if the node is not null and the node value is valid the parsed value, otherwise the default value
  972. +    */
  973. +   default <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz, T defaultValue)
  974. +   {
  975. +       if (node == null)
  976. +       {
  977. +           return defaultValue;
  978. +       }
  979. +      
  980. +       try
  981. +       {
  982. +           return Enum.valueOf(clazz, node.getNodeValue());
  983. +       }
  984. +       catch (IllegalArgumentException e)
  985. +       {
  986. +           LOG.warning("Invalid value specified for node: {} specified value: {} should be enum value of \"{}\" using default value: {}");
  987. +           return defaultValue;
  988. +       }
  989. +   }
  990. +  
  991. +   /**
  992. +    * Parses an enumerated value.
  993. +    * @param <T> the enumerated type
  994. +    * @param node the node to parse
  995. +    * @param clazz the class of the enumerated
  996. +    * @return if the node is not null and the node value is valid the parsed value, otherwise null
  997. +    */
  998. +   default <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz)
  999. +   {
  1000. +       return parseEnum(node, clazz, null);
  1001. +   }
  1002. +  
  1003. +   /**
  1004. +    * Parses an enumerated value.
  1005. +    * @param <T> the enumerated type
  1006. +    * @param attrs the attributes
  1007. +    * @param clazz the class of the enumerated
  1008. +    * @param name the name of the attribute to parse
  1009. +    * @return if the node is not null and the node value is valid the parsed value, otherwise null
  1010. +    */
  1011. +   default <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name)
  1012. +   {
  1013. +       return parseEnum(attrs.getNamedItem(name), clazz);
  1014. +   }
  1015. +  
  1016. +   /**
  1017. +    * Parses an enumerated value.
  1018. +    * @param <T> the enumerated type
  1019. +    * @param attrs the attributes
  1020. +    * @param clazz the class of the enumerated
  1021. +    * @param name the name of the attribute to parse
  1022. +    * @param defaultValue the default value
  1023. +    * @return if the node is not null and the node value is valid the parsed value, otherwise the default value
  1024. +    */
  1025. +   default <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name, T defaultValue)
  1026. +   {
  1027. +       return parseEnum(attrs.getNamedItem(name), clazz, defaultValue);
  1028. +   }
  1029. +  
  1030. +   /**
  1031. +    * Gets the current file filter.
  1032. +    * @return the current file filter
  1033. +    */
  1034. +   default FileFilter getCurrentFileFilter()
  1035. +   {
  1036. +       return XML_FILTER;
  1037. +   }
  1038. +  
  1039. +   static class XMLErrorHandler implements ErrorHandler
  1040. +   {
  1041. +       @Override
  1042. +       public void warning(SAXParseException e) throws SAXParseException
  1043. +       {
  1044. +           throw e;
  1045. +       }
  1046. +      
  1047. +       @Override
  1048. +       public void error(SAXParseException e) throws SAXParseException
  1049. +       {
  1050. +           throw e;
  1051. +       }
  1052. +      
  1053. +       @Override
  1054. +       public void fatalError(SAXParseException e) throws SAXParseException
  1055. +       {
  1056. +           throw e;
  1057. +       }
  1058. +   }
  1059. +}
  1060. diff --git java/Base/Xml/XMLFilter.java java/Base/Xml/XMLFilter.java
  1061. new file mode 100644
  1062. index 0000000..faa1805
  1063. --- /dev/null
  1064. +++ java/Base/Xml/XMLFilter.java
  1065. @@ -0,0 +1,17 @@
  1066. +package Base.Xml;
  1067. +
  1068. +import java.io.File;
  1069. +import java.io.FileFilter;
  1070. +
  1071. +public class XMLFilter implements FileFilter
  1072. +{
  1073. +   @Override
  1074. +   public boolean accept(File f)
  1075. +   {
  1076. +       if ((f == null) || !f.isFile())
  1077. +       {
  1078. +           return false;
  1079. +       }
  1080. +       return f.getName().toLowerCase().endsWith(".xml");
  1081. +   }
  1082. +}
  1083. diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java
  1084. index 91fc0f1..2307c74 100644
  1085. --- java/net/sf/l2j/Config.java
  1086. +++ java/net/sf/l2j/Config.java
  1087. @@ -58,6 +58,13 @@
  1088.     public static boolean ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH;
  1089.     public static boolean REMOVE_CASTLE_CIRCLETS;
  1090.    
  1091. +  
  1092. +   public static boolean ALLOW_DRESS_ME_SYSTEM;
  1093. +   public static String DRESS_ME_COMMAND;
  1094. +   public static boolean ALLOW_DRESS_ME_FOR_PREMIUM;
  1095. +   public static boolean ALLOW_DRESS_ME_IN_OLY;   
  1096. +  
  1097. +  
  1098.     /** Manor */
  1099.     public static int ALT_MANOR_REFRESH_TIME;
  1100.     public static int ALT_MANOR_REFRESH_MIN;
  1101. @@ -1081,6 +1088,15 @@
  1102.         ALT_GAME_DELEVEL = players.getProperty("Delevel", true);
  1103.         DEATH_PENALTY_CHANCE = players.getProperty("DeathPenaltyChance", 20);
  1104.        
  1105. +       ALLOW_DRESS_ME_SYSTEM = players.getProperty("AllowDressMeSystem", false);
  1106. +       DRESS_ME_COMMAND = players.getProperty("DressMeCommand", "dressme");
  1107. +       ALLOW_DRESS_ME_FOR_PREMIUM = players.getProperty("AllowDressMeForPremiumOnly", false);
  1108. +       ALLOW_DRESS_ME_IN_OLY = players.getProperty("AllowDressMeInOly", false);
  1109. +      
  1110. +      
  1111. +      
  1112. +      
  1113. +      
  1114.         INVENTORY_MAXIMUM_NO_DWARF = players.getProperty("MaximumSlotsForNoDwarf", 80);
  1115.         INVENTORY_MAXIMUM_DWARF = players.getProperty("MaximumSlotsForDwarf", 100);
  1116.         INVENTORY_MAXIMUM_QUEST_ITEMS = players.getProperty("MaximumSlotsForQuestItems", 100);
  1117. diff --git java/net/sf/l2j/gameserver/GameServer.java java/net/sf/l2j/gameserver/GameServer.java
  1118. index 65bf5ef..ab80e3e 100644
  1119. --- java/net/sf/l2j/gameserver/GameServer.java
  1120. +++ java/net/sf/l2j/gameserver/GameServer.java
  1121. @@ -83,6 +83,7 @@
  1122. import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  1123. import net.sf.l2j.gameserver.model.World;
  1124. import net.sf.l2j.gameserver.model.entity.Hero;
  1125. +import net.sf.l2j.gameserver.model.item.kind.Item;
  1126. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  1127. import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
  1128. import net.sf.l2j.gameserver.model.partymatching.PartyMatchRoomList;
  1129. @@ -108,6 +109,9 @@
  1130. import net.sf.l2j.util.DeadLockDetector;
  1131. import net.sf.l2j.util.IPv4Filter;
  1132.  
  1133. +import Base.Skin.DressMeData;
  1134. +
  1135. +
  1136. public class GameServer
  1137. {
  1138.     private static final Logger _log = Logger.getLogger(GameServer.class.getName());
  1139. @@ -281,6 +285,17 @@
  1140.             BoatTalkingGludin.load();
  1141.         }
  1142.        
  1143. +       Item.LoadAllIcons();
  1144. +      
  1145. +       if (Config.ALLOW_DRESS_ME_SYSTEM)
  1146. +       {
  1147. +           StringUtil.printSection("Dress Me / Skins");
  1148. +           DressMeData.getInstance();
  1149. +       }
  1150. +      
  1151. +      
  1152. +      
  1153. +      
  1154.         StringUtil.printSection("Events");
  1155.         DerbyTrackManager.getInstance();
  1156.         LotteryManager.getInstance();
  1157. diff --git java/net/sf/l2j/gameserver/handler/BypassHandler.java java/net/sf/l2j/gameserver/handler/BypassHandler.java
  1158. new file mode 100644
  1159. index 0000000..2cbae33
  1160. --- /dev/null
  1161. +++ java/net/sf/l2j/gameserver/handler/BypassHandler.java
  1162. @@ -0,0 +1,69 @@
  1163. +package net.sf.l2j.gameserver.handler;
  1164. +
  1165. +import java.util.HashMap;
  1166. +import java.util.Map;
  1167. +import java.util.logging.Logger;
  1168. +
  1169. +import net.sf.l2j.Config;
  1170. +
  1171. +
  1172. +
  1173. +/**
  1174. + * @author Dwight
  1175. + */
  1176. +public class BypassHandler
  1177. +{
  1178. +   private static Logger _log = Logger.getLogger(BypassHandler.class.getName());
  1179. +   private final Map<Integer, IBypassHandler> _datatable = new HashMap<>();
  1180. +  
  1181. +   public static BypassHandler getInstance()
  1182. +   {
  1183. +       return SingletonHolder._instance;
  1184. +   }
  1185. +  
  1186. +   private BypassHandler()
  1187. +   {
  1188. +      
  1189. +  
  1190. +      
  1191. +   }
  1192. +  
  1193. +   public void registerBypassHandler(IBypassHandler handler)
  1194. +   {
  1195. +       String[] ids = handler.getBypassHandlersList();
  1196. +       for (int i = 0; i < ids.length; i++)
  1197. +       {
  1198. +           if (Config.DEBUG)
  1199. +           {
  1200. +               _log.fine("Adding handler for command " + ids[i]);
  1201. +           }
  1202. +           _datatable.put(ids[i].hashCode(), handler);
  1203. +       }
  1204. +   }
  1205. +  
  1206. +   public IBypassHandler getBypassHandler(String bypass)
  1207. +   {
  1208. +       String command = bypass;
  1209. +      
  1210. +       if (bypass.indexOf(" ") != -1)
  1211. +       {
  1212. +           command = bypass.substring(0, bypass.indexOf(" "));
  1213. +       }
  1214. +      
  1215. +       if (Config.DEBUG)
  1216. +       {
  1217. +           _log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command.hashCode()) != null));
  1218. +       }
  1219. +       return _datatable.get(command.hashCode());
  1220. +   }
  1221. +  
  1222. +   public int size()
  1223. +   {
  1224. +       return _datatable.size();
  1225. +   }
  1226. +  
  1227. +   private static class SingletonHolder
  1228. +   {
  1229. +       protected static final BypassHandler _instance = new BypassHandler();
  1230. +   }
  1231. +}
  1232. diff --git java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java
  1233. new file mode 100644
  1234. index 0000000..ce0210b
  1235. --- /dev/null
  1236. +++ java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java
  1237. @@ -0,0 +1,69 @@
  1238. +
  1239. +package net.sf.l2j.gameserver.handler;
  1240. +
  1241. +import java.util.HashMap;
  1242. +import java.util.Map;
  1243. +
  1244. +import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe;
  1245. +import net.sf.l2j.gameserver.model.actor.instance.Player;
  1246. +
  1247. +
  1248. +
  1249. +public class CustomBypassHandler
  1250. +{
  1251. +
  1252. +  
  1253. +   private static CustomBypassHandler _instance = null;
  1254. +   private final Map<String, ICustomByPassHandler> _handlers;
  1255. +  
  1256. +   private CustomBypassHandler()
  1257. +   {
  1258. +       _handlers = new HashMap<>();
  1259. +      
  1260. +      
  1261. +       registerCustomBypassHandler(new DressMe());
  1262. +   }
  1263. +  
  1264. +   public static CustomBypassHandler getInstance()
  1265. +   {
  1266. +       if (_instance == null)
  1267. +       {
  1268. +           _instance = new CustomBypassHandler();
  1269. +       }
  1270. +      
  1271. +       return _instance;
  1272. +   }
  1273. +  
  1274. +   public void registerCustomBypassHandler(final ICustomByPassHandler handler)
  1275. +   {
  1276. +       for (final String s : handler.getByPassCommands())
  1277. +       {
  1278. +           _handlers.put(s, handler);
  1279. +       }
  1280. +   }
  1281. +  
  1282. +   public void handleBypass(final Player player, final String command)
  1283. +   {
  1284. +       String cmd = "";
  1285. +       String params = "";
  1286. +       final int iPos = command.indexOf(" ");
  1287. +       if (iPos != -1)
  1288. +       {
  1289. +           cmd = command.substring(7, iPos);
  1290. +           params = command.substring(iPos + 1);
  1291. +       }
  1292. +       else
  1293. +       {
  1294. +           cmd = command.substring(7);
  1295. +       }
  1296. +       final ICustomByPassHandler ch = _handlers.get(cmd);
  1297. +       if (ch != null)
  1298. +       {
  1299. +           ch.handleCommand(cmd, player, params);
  1300. +       }
  1301. +       else
  1302. +       {
  1303. +
  1304. +       }
  1305. +   }
  1306. +}
  1307. \ No newline at end of file
  1308. diff --git java/net/sf/l2j/gameserver/handler/IBypassHandler.java java/net/sf/l2j/gameserver/handler/IBypassHandler.java
  1309. new file mode 100644
  1310. index 0000000..32bc7b4
  1311. --- /dev/null
  1312. +++ java/net/sf/l2j/gameserver/handler/IBypassHandler.java
  1313. @@ -0,0 +1,13 @@
  1314. +package net.sf.l2j.gameserver.handler;
  1315. +
  1316. +import net.sf.l2j.gameserver.model.actor.instance.Player;
  1317. +
  1318. +/**
  1319. + * @author Dwight
  1320. + */
  1321. +public interface IBypassHandler
  1322. +{
  1323. +   public boolean handleBypass(String bypass, Player activeChar);
  1324. +  
  1325. +   public String[] getBypassHandlersList();
  1326. +}
  1327. diff --git java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java
  1328. new file mode 100644
  1329. index 0000000..6312dc0
  1330. --- /dev/null
  1331. +++ java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java
  1332. @@ -0,0 +1,10 @@
  1333. +package net.sf.l2j.gameserver.handler;
  1334. +
  1335. +import net.sf.l2j.gameserver.model.actor.instance.Player;
  1336. +
  1337. +public interface ICustomByPassHandler
  1338. +{
  1339. +   public String[] getByPassCommands();
  1340. +  
  1341. +   public void handleCommand(String command, Player player, String parameters);
  1342. +}
  1343. diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  1344. index a1b430a..ca516e6 100644
  1345. --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  1346. +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  1347. @@ -17,6 +17,10 @@
  1348. import java.util.HashMap;
  1349. import java.util.Map;
  1350.  
  1351. +import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe;
  1352. +
  1353. +
  1354. +
  1355. public class VoicedCommandHandler
  1356. {
  1357.     private final Map<Integer, IVoicedCommandHandler> _datatable = new HashMap<>();
  1358. @@ -28,7 +32,7 @@
  1359.  
  1360.     protected VoicedCommandHandler()
  1361.     {
  1362. -
  1363. +       registerHandler(new DressMe());
  1364.     }
  1365.     public void registerHandler(IVoicedCommandHandler handler)
  1366.     {
  1367. diff --git java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java
  1368. new file mode 100644
  1369. index 0000000..4d5948c
  1370. --- /dev/null
  1371. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java
  1372. @@ -0,0 +1,93 @@
  1373. +package net.sf.l2j.gameserver.handler.usercommandhandlers;
  1374. +
  1375. +import java.text.SimpleDateFormat;
  1376. +import java.util.Date;
  1377. +
  1378. +import net.sf.l2j.Config;
  1379. +import net.sf.l2j.gameserver.cache.HtmCache;
  1380. +import net.sf.l2j.gameserver.handler.ICustomByPassHandler;
  1381. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  1382. +import net.sf.l2j.gameserver.model.actor.instance.Player;
  1383. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  1384. +
  1385. +
  1386. +
  1387. +public class DressMe implements IVoicedCommandHandler, ICustomByPassHandler
  1388. +{
  1389. +   private static String[] _voicedCommands =
  1390. +   {
  1391. +       Config.DRESS_ME_COMMAND
  1392. +   };
  1393. +  
  1394. +   @Override
  1395. +   public boolean useVoicedCommand(String command, Player activeChar, String target)
  1396. +   {
  1397. +
  1398. +      
  1399. +       if (command.startsWith(Config.DRESS_ME_COMMAND))
  1400. +       {
  1401. +           showHtm(activeChar);
  1402. +       }
  1403. +      
  1404. +
  1405. +       return true;
  1406. +   }
  1407. +  
  1408. +   private static void showHtm(Player player)
  1409. +   {
  1410. +       NpcHtmlMessage htm = new NpcHtmlMessage(1);
  1411. +       String text = HtmCache.getInstance().getHtm("data/html/dressme/index.htm");
  1412. +      
  1413. +       htm.setHtml(text);
  1414. +      
  1415. +       {
  1416. +           htm.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
  1417. +           htm.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
  1418. +          
  1419. +       }
  1420. +      
  1421. +       player.sendPacket(htm);
  1422. +   }
  1423. +  
  1424. +   static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  1425. +  
  1426. +   @Override
  1427. +   public String[] getVoicedCommandList()
  1428. +   {
  1429. +       return _voicedCommands;
  1430. +   }
  1431. +  
  1432. +   @Override
  1433. +   public String[] getByPassCommands()
  1434. +   {
  1435. +       return new String[]
  1436. +       {
  1437. +           "dressme_back"
  1438. +       };
  1439. +   }
  1440. +  
  1441. +   private enum CommandEnum
  1442. +   {
  1443. +       dressme_back,
  1444. +   }
  1445. +  
  1446. +   @Override
  1447. +   public void handleCommand(String command, Player player, String parameters)
  1448. +   {
  1449. +       CommandEnum comm = CommandEnum.valueOf(command);
  1450. +      
  1451. +       if (comm == null)
  1452. +       {
  1453. +           return;
  1454. +       }
  1455. +      
  1456. +       switch (comm)
  1457. +       {
  1458. +           case dressme_back:
  1459. +           {
  1460. +               showHtm(player);
  1461. +           }
  1462. +               break;
  1463. +       }
  1464. +   }
  1465. +}
  1466. \ No newline at end of file
  1467. diff --git java/net/sf/l2j/gameserver/model/actor/instance/Player.java java/net/sf/l2j/gameserver/model/actor/instance/Player.java
  1468. index b2f5469..6f6c777 100644
  1469. --- java/net/sf/l2j/gameserver/model/actor/instance/Player.java
  1470. +++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java
  1471. @@ -13,6 +13,7 @@
  1472. import java.util.Set;
  1473. import java.util.concurrent.ConcurrentHashMap;
  1474. import java.util.concurrent.ConcurrentSkipListMap;
  1475. +import java.util.concurrent.CopyOnWriteArrayList;
  1476. import java.util.concurrent.Future;
  1477. import java.util.concurrent.ScheduledFuture;
  1478. import java.util.concurrent.TimeUnit;
  1479. @@ -28,6 +29,7 @@
  1480. import net.sf.l2j.Config;
  1481. import net.sf.l2j.L2DatabaseFactory;
  1482. import net.sf.l2j.gameserver.LoginServerThread;
  1483. import net.sf.l2j.gameserver.communitybbs.BB.Forum;
  1484. import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
  1485. import net.sf.l2j.gameserver.data.ItemTable;
  1486. @@ -46,6 +48,7 @@
  1487. import net.sf.l2j.gameserver.data.xml.PlayerData;
  1488. import net.sf.l2j.gameserver.data.xml.RecipeData;
  1489. import net.sf.l2j.gameserver.geoengine.GeoEngine;
  1490. import net.sf.l2j.gameserver.handler.IItemHandler;
  1491. import net.sf.l2j.gameserver.handler.ItemHandler;
  1492. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
  1493. @@ -241,6 +244,13 @@
  1494. import net.sf.l2j.gameserver.templates.skills.L2SkillType;
  1495. import net.sf.l2j.gameserver.util.Broadcast;
  1496.  
  1497.  
  1498.  
  1499. /**
  1500.  * This class represents a player in the world.<br>
  1501.  * There is always a client-thread connected to this (except if a player-store is activated upon logout).
  1502. @@ -306,6 +316,33 @@
  1503.         }
  1504.     }
  1505.    
  1506. +  
  1507. +   private int _armorSkinOption = 0;
  1508. +   private int _weaponSkinOption = 0;
  1509. +   private int _hairSkinOption = 0;
  1510. +   private int _faceSkinOption = 0;
  1511. +   private int _shieldSkinOption = 0;
  1512. +
  1513. +
  1514. +   private boolean isTryingSkin = false;
  1515. +   private boolean isTryingSkinPremium = false;
  1516. +   private List<Integer> _armorSkins = new CopyOnWriteArrayList<>();
  1517. +   private List<Integer> _weaponSkins = new CopyOnWriteArrayList<>();
  1518. +   private List<Integer> _hairSkins = new CopyOnWriteArrayList<>();
  1519. +   private List<Integer> _faceSkins = new CopyOnWriteArrayList<>();
  1520. +   private List<Integer> _shieldSkins = new CopyOnWriteArrayList<>();
  1521. +  
  1522. +  
  1523. +       private static final String INSERT_OR_UPDATE_CHARACTER_DRESSME_DATA = "INSERT INTO characters_dressme_data (obj_Id, armor_skins, armor_skin_option, weapon_skins, weapon_skin_option, hair_skins, hair_skin_option, face_skins, face_skin_option) VALUES (?,?,?,?,?,?,?,?,?) "
  1524. +       + "ON DUPLICATE KEY UPDATE obj_Id=?, armor_skins=?, armor_skin_option=?, weapon_skins=?, weapon_skin_option=?, hair_skins=?, hair_skin_option=?, face_skins=?, face_skin_option=?, shield_skins=?, shield_skin_option=?";
  1525. +   private static final String RESTORE_CHARACTER_DRESSME_DATA = "SELECT obj_Id, armor_skins, armor_skin_option, weapon_skins, weapon_skin_option, hair_skins, hair_skin_option, face_skins, face_skin_option, shield_skins, shield_skin_option FROM characters_dressme_data WHERE obj_id=?";
  1526. +  
  1527. +  
  1528. +  
  1529. +  
  1530. +  
  1531. +  
  1532. +  
  1533.     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
  1534.     private static final String ADD_OR_UPDATE_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE skill_level=?";
  1535.     private static final String DELETE_SKILL_FROM_CHAR = "DELETE FROM character_skills WHERE skill_id=? AND char_obj_id=? AND class_index=?";
  1536.  
  1537.  
  1538.  
  1539.  
  1540. @@ -1225,6 +1264,28 @@
  1541.        if (item.getItem() instanceof Weapon)
  1542.            item.unChargeAllShots();
  1543.        
  1544. +      
  1545. +      
  1546. +
  1547. +       if (getWeaponSkinOption() > 0 && DressMeData.getInstance().getWeaponSkinsPackage(getWeaponSkinOption()) != null)
  1548. +       {
  1549. +           sendMessage("At first you must to remove a skin of weapon.");
  1550. +           sendPacket(new ExShowScreenMessage("At first you must to remove a skin of weapon.", 2000));
  1551. +           sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  1552. +           return;
  1553. +       }
  1554. +      
  1555. +       if (getShieldSkinOption() > 0 && DressMeData.getInstance().getShieldSkinsPackage(getShieldSkinOption()) != null)
  1556. +       {
  1557. +           sendMessage("At first you must to remove a skin of weapon.");
  1558. +           sendPacket(new ExShowScreenMessage("At first you must to remove a skin of weapon.", 2000));
  1559. +           sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  1560. +           return;
  1561. +       }
  1562. +      
  1563. +      
  1564. +      
  1565. +      
  1566.        if (isEquipped)
  1567.        {
  1568.            if (item.getEnchantLevel() > 0)
  1569.  
  1570.  
  1571. @@ -5298,6 +5335,7 @@
  1572.                 player.refreshExpertisePenalty();
  1573.                
  1574.                 player.restoreFriendList();
  1575. +               player.restoreDressMeData();
  1576.                
  1577.                 // Retrieve the name and ID of the other characters assigned to this account.
  1578.                 PreparedStatement stmt = con.prepareStatement("SELECT obj_Id, char_name FROM characters WHERE account_name=? AND obj_Id<>?");
  1579. @@ -5500,6 +5538,16 @@
  1580.      */
  1581.     public synchronized void store(boolean storeActiveEffects)
  1582.     {
  1583. +      
  1584. +      
  1585. +               if (!isTryingSkin() || !isTryingSkinPremium())
  1586. +                   {
  1587. +                       storeDressMeData();
  1588. +                   }
  1589. +      
  1590. +      
  1591. +      
  1592. +      
  1593.         // update client coords, if these look like true
  1594.         if (isInsideRadius(getClientX(), getClientY(), 1000, true))
  1595.             setXYZ(getClientX(), getClientY(), getClientZ());
  1596. @@ -10289,4 +10337,544 @@
  1597.             }
  1598.         }
  1599.     }
  1600. +  
  1601. +  
  1602. +  
  1603. +  
  1604. +  
  1605. +
  1606. +   @SuppressWarnings("resource")
  1607. +   private synchronized void storeDressMeData()
  1608. +   {
  1609. +      
  1610. +       Connection con = null;
  1611. +       try
  1612. +       {
  1613. +           con = L2DatabaseFactory.getInstance().getConnection();
  1614. +           PreparedStatement statement = con.prepareStatement(INSERT_OR_UPDATE_CHARACTER_DRESSME_DATA);
  1615. +          
  1616. +           statement.setInt(1, getObjectId());
  1617. +           if (_armorSkins.isEmpty())
  1618. +           {
  1619. +               statement.setString(2, "");
  1620. +           }
  1621. +           else
  1622. +           {
  1623. +               String s = "";
  1624. +               for (int i : _armorSkins)
  1625. +               {
  1626. +                   s += String.valueOf(i) + ",";
  1627. +               }
  1628. +               statement.setString(2, s);
  1629. +           }
  1630. +           statement.setInt(3, getArmorSkinOption());
  1631. +          
  1632. +           if (_weaponSkins.isEmpty())
  1633. +           {
  1634. +               statement.setString(4, "");
  1635. +           }
  1636. +           else
  1637. +           {
  1638. +               String s = "";
  1639. +               for (int i : _weaponSkins)
  1640. +               {
  1641. +                   s += String.valueOf(i) + ",";
  1642. +               }
  1643. +               statement.setString(4, s);
  1644. +           }
  1645. +           statement.setInt(5, getWeaponSkinOption());
  1646. +          
  1647. +           if (_hairSkins.isEmpty())
  1648. +           {
  1649. +               statement.setString(6, "");
  1650. +           }
  1651. +           else
  1652. +           {
  1653. +               String s = "";
  1654. +               for (int i : _hairSkins)
  1655. +               {
  1656. +                   s += String.valueOf(i) + ",";
  1657. +               }
  1658. +               statement.setString(6, s);
  1659. +           }
  1660. +           statement.setInt(7, getHairSkinOption());
  1661. +          
  1662. +           if (_faceSkins.isEmpty())
  1663. +           {
  1664. +               statement.setString(8, "");
  1665. +           }
  1666. +           else
  1667. +           {
  1668. +               String s = "";
  1669. +               for (int i : _faceSkins)
  1670. +               {
  1671. +                   s += String.valueOf(i) + ",";
  1672. +               }
  1673. +               statement.setString(8, s);
  1674. +           }
  1675. +           statement.setInt(9, getFaceSkinOption());
  1676. +          
  1677. +           if (_shieldSkins.isEmpty())
  1678. +           {
  1679. +               statement.setString(10, "");
  1680. +           }
  1681. +           else
  1682. +           {
  1683. +               String s = "";
  1684. +               for (int i : _shieldSkins)
  1685. +               {
  1686. +                   s += String.valueOf(i) + ",";
  1687. +               }
  1688. +               statement.setString(10, s);
  1689. +           }
  1690. +           statement.setInt(11, getShieldSkinOption());
  1691. +          
  1692. +           // second part
  1693. +          
  1694. +           statement.setInt(10, getObjectId());
  1695. +           if (_armorSkins.isEmpty())
  1696. +           {
  1697. +               statement.setString(11, "");
  1698. +           }
  1699. +           else
  1700. +           {
  1701. +               String s = "";
  1702. +               for (int i : _armorSkins)
  1703. +               {
  1704. +                   s += String.valueOf(i) + ",";
  1705. +               }
  1706. +               statement.setString(11, s);
  1707. +           }
  1708. +           statement.setInt(12, getArmorSkinOption());
  1709. +          
  1710. +           if (_weaponSkins.isEmpty())
  1711. +           {
  1712. +               statement.setString(13, "");
  1713. +           }
  1714. +           else
  1715. +           {
  1716. +               String s = "";
  1717. +               for (int i : _weaponSkins)
  1718. +               {
  1719. +                   s += String.valueOf(i) + ",";
  1720. +               }
  1721. +               statement.setString(13, s);
  1722. +           }
  1723. +           statement.setInt(14, getWeaponSkinOption());
  1724. +          
  1725. +           if (_hairSkins.isEmpty())
  1726. +           {
  1727. +               statement.setString(15, "");
  1728. +           }
  1729. +           else
  1730. +           {
  1731. +               String s = "";
  1732. +               for (int i : _hairSkins)
  1733. +               {
  1734. +                   s += String.valueOf(i) + ",";
  1735. +               }
  1736. +               statement.setString(15, s);
  1737. +           }
  1738. +           statement.setInt(16, getHairSkinOption());
  1739. +          
  1740. +           if (_faceSkins.isEmpty())
  1741. +           {
  1742. +               statement.setString(17, "");
  1743. +           }
  1744. +           else
  1745. +           {
  1746. +               String s = "";
  1747. +               for (int i : _faceSkins)
  1748. +               {
  1749. +                   s += String.valueOf(i) + ",";
  1750. +               }
  1751. +               statement.setString(17, s);
  1752. +           }
  1753. +           statement.setInt(18, getFaceSkinOption());
  1754. +          
  1755. +           if (_shieldSkins.isEmpty())
  1756. +           {
  1757. +               statement.setString(19, "");
  1758. +           }
  1759. +           else
  1760. +           {
  1761. +               String s = "";
  1762. +               for (int i : _shieldSkins)
  1763. +               {
  1764. +                   s += String.valueOf(i) + ",";
  1765. +               }
  1766. +               statement.setString(19, s);
  1767. +           }
  1768. +           statement.setInt(20, getShieldSkinOption());
  1769. +          
  1770. +           statement.execute();
  1771. +           statement.close();
  1772. +       }
  1773. +       catch (Exception e)
  1774. +       {
  1775. +      
  1776. +               _log.warning("Could not store storeDressMeData():");
  1777. +               e.printStackTrace();
  1778. +          
  1779. +       }
  1780. +       finally
  1781. +       {
  1782. +          
  1783. +       }
  1784. +   }
  1785. +
  1786. +
  1787. +
  1788. +
  1789. +   @SuppressWarnings("resource")
  1790. +   private void restoreDressMeData()
  1791. +   {
  1792. +
  1793. +       Connection con = null;
  1794. +       try
  1795. +       {
  1796. +           con = L2DatabaseFactory.getInstance().getConnection();
  1797. +           PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER_DRESSME_DATA);
  1798. +          
  1799. +           statement.setInt(1, getObjectId());
  1800. +           ResultSet rset = statement.executeQuery();
  1801. +          
  1802. +           while (rset.next())
  1803. +           {
  1804. +               String armorskinIds = rset.getString("armor_skins");
  1805. +               if (armorskinIds != null && armorskinIds.length() > 0)
  1806. +               {
  1807. +                   for (String s : armorskinIds.split(","))
  1808. +                   {
  1809. +                       if (s == null)
  1810. +                       {
  1811. +                           continue;
  1812. +                       }
  1813. +                       buyArmorSkin(Integer.parseInt(s));
  1814. +                   }
  1815. +               }
  1816. +               setArmorSkinOption(rset.getInt("armor_skin_option"));
  1817. +              
  1818. +               String weaponskinIds = rset.getString("weapon_skins");
  1819. +               if (weaponskinIds != null && weaponskinIds.length() > 0)
  1820. +               {
  1821. +                   for (String s : weaponskinIds.split(","))
  1822. +                   {
  1823. +                       if (s == null)
  1824. +                       {
  1825. +                           continue;
  1826. +                       }
  1827. +                       buyWeaponSkin(Integer.parseInt(s));
  1828. +                   }
  1829. +               }
  1830. +               setWeaponSkinOption(rset.getInt("weapon_skin_option"));
  1831. +              
  1832. +               String hairskinIds = rset.getString("hair_skins");
  1833. +               if (hairskinIds != null && hairskinIds.length() > 0)
  1834. +               {
  1835. +                   for (String s : hairskinIds.split(","))
  1836. +                   {
  1837. +                       if (s == null)
  1838. +                       {
  1839. +                           continue;
  1840. +                       }
  1841. +                       buyHairSkin(Integer.parseInt(s));
  1842. +                   }
  1843. +               }
  1844. +               setHairSkinOption(rset.getInt("hair_skin_option"));
  1845. +              
  1846. +               String faceskinIds = rset.getString("face_skins");
  1847. +               if (faceskinIds != null && faceskinIds.length() > 0)
  1848. +               {
  1849. +                   for (String s : faceskinIds.split(","))
  1850. +                   {
  1851. +                       if (s == null)
  1852. +                       {
  1853. +                           continue;
  1854. +                       }
  1855. +                       buyFaceSkin(Integer.parseInt(s));
  1856. +                   }
  1857. +               }
  1858. +               setFaceSkinOption(rset.getInt("face_skin_option"));
  1859. +              
  1860. +               String shieldkinIds = rset.getString("shield_skins");
  1861. +               if (shieldkinIds != null && shieldkinIds.length() > 0)
  1862. +               {
  1863. +                   for (String s : shieldkinIds.split(","))
  1864. +                   {
  1865. +                       if (s == null)
  1866. +                       {
  1867. +                           continue;
  1868. +                       }
  1869. +                       buyShieldSkin(Integer.parseInt(s));
  1870. +                   }
  1871. +               }
  1872. +               setShieldSkinOption(rset.getInt("shield_skin_option"));
  1873. +           }
  1874. +          
  1875. +           rset.close();
  1876. +           statement.close();
  1877. +       }
  1878. +       catch (Exception e)
  1879. +       {
  1880. +           _log.warning("Could not restore char data:");
  1881. +           e.printStackTrace();
  1882. +       }
  1883. +       finally
  1884. +       {
  1885. +          
  1886. +       }
  1887. +   }
  1888. +
  1889. +
  1890. +
  1891. +
  1892. +
  1893. +
  1894. +
  1895. +
  1896. +
  1897. +
  1898. +  
  1899. +   // Dress Me
  1900. +   public boolean isTryingSkin()
  1901. +   {
  1902. +       return isTryingSkin;
  1903. +   }
  1904. +  
  1905. +   public void setIsTryingSkin(boolean b)
  1906. +   {
  1907. +       isTryingSkin = b;
  1908. +   }
  1909. +  
  1910. +   public boolean isTryingSkinPremium()
  1911. +   {
  1912. +       return isTryingSkinPremium;
  1913. +   }
  1914. +  
  1915. +   public void setIsTryingSkinPremium(boolean b)
  1916. +   {
  1917. +       isTryingSkinPremium = b;
  1918. +   }
  1919. +  
  1920. +   public boolean hasArmorSkin(int skin)
  1921. +   {
  1922. +       return _armorSkins.contains(skin);
  1923. +   }
  1924. +  
  1925. +   public boolean hasWeaponSkin(int skin)
  1926. +   {
  1927. +       return _weaponSkins.contains(skin);
  1928. +   }
  1929. +  
  1930. +   public boolean hasHairSkin(int skin)
  1931. +   {
  1932. +       return _hairSkins.contains(skin);
  1933. +   }
  1934. +  
  1935. +   public boolean hasFaceSkin(int skin)
  1936. +   {
  1937. +       return _faceSkins.contains(skin);
  1938. +   }
  1939. +  
  1940. +   public boolean hasShieldSkin(int skin)
  1941. +   {
  1942. +       return _shieldSkins.contains(skin);
  1943. +   }
  1944. +  
  1945. +   public boolean hasEquippedArmorSkin(String skin)
  1946. +   {
  1947. +       return String.valueOf(_armorSkinOption).contains(String.valueOf(skin));
  1948. +   }
  1949. +  
  1950. +   public boolean hasEquippedWeaponSkin(String skin)
  1951. +   {
  1952. +       return String.valueOf(_weaponSkinOption).contains(String.valueOf(skin));
  1953. +   }
  1954. +  
  1955. +   public boolean hasEquippedHairSkin(String skin)
  1956. +   {
  1957. +       return String.valueOf(_hairSkinOption).contains(String.valueOf(skin));
  1958. +   }
  1959. +  
  1960. +   public boolean hasEquippedFaceSkin(String skin)
  1961. +   {
  1962. +       return String.valueOf(_faceSkinOption).contains(String.valueOf(skin));
  1963. +   }
  1964. +  
  1965. +   public boolean hasEquippedShieldSkin(String skin)
  1966. +   {
  1967. +       return String.valueOf(_shieldSkinOption).contains(String.valueOf(skin));
  1968. +   }
  1969. +  
  1970. +   public void buyArmorSkin(int id)
  1971. +   {
  1972. +       if (!_armorSkins.contains(id))
  1973. +       {
  1974. +           _armorSkins.add(id);
  1975. +       }
  1976. +   }
  1977. +  
  1978. +   public void buyWeaponSkin(int id)
  1979. +   {
  1980. +       if (!_weaponSkins.contains(id))
  1981. +       {
  1982. +           _weaponSkins.add(id);
  1983. +       }
  1984. +   }
  1985. +  
  1986. +   public void buyHairSkin(int id)
  1987. +   {
  1988. +       if (!_hairSkins.contains(id))
  1989. +       {
  1990. +           _hairSkins.add(id);
  1991. +       }
  1992. +   }
  1993. +  
  1994. +   public void buyFaceSkin(int id)
  1995. +   {
  1996. +       if (!_faceSkins.contains(id))
  1997. +       {
  1998. +           _faceSkins.add(id);
  1999. +       }
  2000. +   }
  2001. +  
  2002. +   public void buyShieldSkin(int id)
  2003. +   {
  2004. +       if (!_shieldSkins.contains(id))
  2005. +       {
  2006. +           _shieldSkins.add(id);
  2007. +       }
  2008. +   }
  2009. +  
  2010. +   public void setArmorSkinOption(int armorSkinOption)
  2011. +   {
  2012. +       _armorSkinOption = armorSkinOption;
  2013. +   }
  2014. +  
  2015. +   public int getArmorSkinOption()
  2016. +   {
  2017. +       return _armorSkinOption;
  2018. +   }
  2019. +  
  2020. +   public void setWeaponSkinOption(int weaponSkinOption)
  2021. +   {
  2022. +       _weaponSkinOption = weaponSkinOption;
  2023. +   }
  2024. +  
  2025. +   public int getWeaponSkinOption()
  2026. +   {
  2027. +       return _weaponSkinOption;
  2028. +   }
  2029. +  
  2030. +   public void setHairSkinOption(int hairSkinOption)
  2031. +   {
  2032. +       _hairSkinOption = hairSkinOption;
  2033. +   }
  2034. +  
  2035. +   public int getHairSkinOption()
  2036. +   {
  2037. +       return _hairSkinOption;
  2038. +   }
  2039. +  
  2040. +   public void setFaceSkinOption(int faceSkinOption)
  2041. +   {
  2042. +       _faceSkinOption = faceSkinOption;
  2043. +   }
  2044. +  
  2045. +   public int getFaceSkinOption()
  2046. +   {
  2047. +       return _faceSkinOption;
  2048. +   }
  2049. +  
  2050. +   public void setShieldSkinOption(int shieldSkinOption)
  2051. +   {
  2052. +       _shieldSkinOption = shieldSkinOption;
  2053. +   }
  2054. +  
  2055. +   public int getShieldSkinOption()
  2056. +   {
  2057. +       return _shieldSkinOption;
  2058. +   }
  2059.    
  2060.  
  2061.  
  2062. }
  2063. \ No newline at end of file
  2064. diff --git java/net/sf/l2j/gameserver/model/item/kind/Item.java java/net/sf/l2j/gameserver/model/item/kind/Item.java
  2065. index f72530e..2c2edae 100644
  2066. --- java/net/sf/l2j/gameserver/model/item/kind/Item.java
  2067. +++ java/net/sf/l2j/gameserver/model/item/kind/Item.java
  2068. @@ -1,10 +1,16 @@
  2069. package net.sf.l2j.gameserver.model.item.kind;
  2070.  
  2071. +import java.sql.Connection;
  2072. +import java.sql.PreparedStatement;
  2073. +import java.sql.ResultSet;
  2074. import java.util.ArrayList;
  2075. import java.util.Collections;
  2076. +import java.util.HashMap;
  2077. import java.util.List;
  2078. +import java.util.Map;
  2079. import java.util.logging.Logger;
  2080.  
  2081. +import net.sf.l2j.L2DatabaseFactory;
  2082. import net.sf.l2j.gameserver.data.ItemTable;
  2083. import net.sf.l2j.gameserver.model.WorldObject;
  2084. import net.sf.l2j.gameserver.model.actor.Creature;
  2085. @@ -19,6 +25,7 @@
  2086. import net.sf.l2j.gameserver.model.item.type.ItemType;
  2087. import net.sf.l2j.gameserver.model.item.type.MaterialType;
  2088. import net.sf.l2j.gameserver.model.item.type.WeaponType;
  2089. +import net.sf.l2j.gameserver.network.L2GameClient;
  2090. import net.sf.l2j.gameserver.network.SystemMessageId;
  2091. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  2092. import net.sf.l2j.gameserver.scripting.Quest;
  2093. @@ -28,6 +35,8 @@
  2094. import net.sf.l2j.gameserver.skills.conditions.Condition;
  2095. import net.sf.l2j.gameserver.templates.StatsSet;
  2096.  
  2097. +
  2098. +
  2099. /**
  2100.  * This class contains all informations concerning the item (weapon, armor, etc). Mother class of :
  2101.  * <ul>
  2102. @@ -38,6 +47,9 @@
  2103.  */
  2104. public abstract class Item
  2105. {
  2106. +  
  2107. +   private static Map<Integer, String> _Icons = null;
  2108. +   private static L2GameClient _client;
  2109.     public static final int TYPE1_WEAPON_RING_EARRING_NECKLACE = 0;
  2110.     public static final int TYPE1_SHIELD_ARMOR = 1;
  2111.     public static final int TYPE1_ITEM_QUESTITEM_ADENA = 4;
  2112. @@ -577,4 +589,84 @@
  2113.     {
  2114.         return _questEvents;
  2115.     }
  2116. +
  2117. +   public static String getItemIcon(int itemId)
  2118. +   {
  2119. +       if (_Icons != null && !_Icons.isEmpty())
  2120. +       {
  2121. +           return _Icons.get(itemId);
  2122. +       }
  2123. +       return null;
  2124. +   }
  2125. +  
  2126. +   public static void LoadAllIcons()
  2127. +   {
  2128. +       loadIcons();
  2129. +   }
  2130. +  
  2131. +  
  2132. +  
  2133. +   public static String getItemNameById(int itemId)
  2134. +   {
  2135. +        Item item = ItemTable.getInstance().getTemplate(itemId);
  2136. +      
  2137. +       String itemName = "NoName";
  2138. +      
  2139. +       if (itemId != 0)
  2140. +       {
  2141. +           itemName = item.getName();
  2142. +       }
  2143. +      
  2144. +       return itemName;
  2145. +   }
  2146. +  
  2147. +  
  2148. +  
  2149. +  
  2150. +  
  2151. +   /**
  2152. +    * @return The client owner of this char.
  2153. +    */
  2154. +   public L2GameClient getClient()
  2155. +   {
  2156. +       return _client;
  2157. +   }
  2158. +  
  2159. +   public void setClient(L2GameClient client)
  2160. +   {
  2161. +       _client = client;
  2162. +   }
  2163. +  
  2164. +  
  2165. +   @SuppressWarnings("resource")
  2166. +   private static void loadIcons()
  2167. +   {
  2168. +       _Icons = new HashMap<>();
  2169. +  
  2170. +       Connection con = null;
  2171. +       try
  2172. +       {
  2173. +           con = L2DatabaseFactory.getInstance().getConnection();
  2174. +           PreparedStatement statement = con.prepareStatement("SELECT * FROM item_icons");
  2175. +           ResultSet rset = statement.executeQuery();
  2176. +          
  2177. +           while (rset.next())
  2178. +           {
  2179. +               int itemId = rset.getInt("itemId");
  2180. +               String itemIcon = rset.getString("itemIcon");
  2181. +               _Icons.put(itemId, itemIcon);
  2182. +           }
  2183. +          
  2184. +           rset.close();
  2185. +           statement.close();
  2186. +       }
  2187. +       catch (Exception e)
  2188. +       {
  2189. +          
  2190. +       }
  2191. +       finally
  2192. +       {
  2193. +          
  2194. +       }
  2195. +   }
  2196. }
  2197. \ No newline at end of file
  2198. diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  2199. index 7e74c2b..94db266 100644
  2200. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  2201. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  2202. @@ -1,13 +1,23 @@
  2203. package net.sf.l2j.gameserver.network.clientpackets;
  2204.  
  2205. +import java.sql.Date;
  2206. +import java.text.SimpleDateFormat;
  2207. +import java.util.List;
  2208. import java.util.StringTokenizer;
  2209. import java.util.logging.Level;
  2210. import java.util.logging.Logger;
  2211. +import java.util.stream.Collectors;
  2212. +import java.util.stream.Stream;
  2213. +
  2214. +import net.sf.l2j.commons.concurrent.ThreadPool;
  2215.  
  2216. import net.sf.l2j.Config;
  2217. +import net.sf.l2j.gameserver.cache.HtmCache;
  2218. import net.sf.l2j.gameserver.communitybbs.CommunityBoard;
  2219. +import net.sf.l2j.gameserver.data.ItemTable;
  2220. import net.sf.l2j.gameserver.data.xml.AdminData;
  2221. import net.sf.l2j.gameserver.handler.AdminCommandHandler;
  2222. +import net.sf.l2j.gameserver.handler.CustomBypassHandler;
  2223. import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  2224. import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  2225. import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
  2226. @@ -17,12 +27,21 @@
  2227. import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc;
  2228. import net.sf.l2j.gameserver.model.actor.instance.Player;
  2229. import net.sf.l2j.gameserver.model.entity.Hero;
  2230. +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  2231. +import net.sf.l2j.gameserver.model.item.kind.Item;
  2232. +import net.sf.l2j.gameserver.model.item.type.WeaponType;
  2233. import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
  2234. import net.sf.l2j.gameserver.network.FloodProtectors;
  2235. import net.sf.l2j.gameserver.network.FloodProtectors.Action;
  2236. import net.sf.l2j.gameserver.network.SystemMessageId;
  2237. import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  2238. +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
  2239. import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  2240. +import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
  2241. +
  2242. +import Base.Skin.DressMeData;
  2243. +import Base.Skin.SkinPackage;
  2244. +
  2245.  
  2246. public final class RequestBypassToServer extends L2GameClientPacket
  2247. {
  2248. @@ -55,6 +74,9 @@
  2249.        
  2250.         try
  2251.         {
  2252. +          
  2253. +
  2254. +          
  2255.             if (_command.startsWith("admin_"))
  2256.             {
  2257.                 String command = _command.split(" ")[0];
  2258. @@ -132,6 +154,413 @@
  2259.                 else
  2260.                     activeChar.processQuestEvent(str[0], str[1]);
  2261.             }
  2262. +          
  2263. +           else if (_command.startsWith("custom_"))
  2264. +           {
  2265. +               Player player = getClient().getActiveChar();
  2266. +               CustomBypassHandler.getInstance().handleBypass(player, _command);
  2267. +           }
  2268. +          
  2269. +          
  2270. +           else if (_command.startsWith("dressme"))
  2271. +           {
  2272. +               if (!Config.ALLOW_DRESS_ME_IN_OLY && activeChar.isInOlympiadMode())
  2273. +               {
  2274. +                   activeChar.sendMessage("DressMe can't be used on The Olympiad game.");
  2275. +                   return;
  2276. +               }
  2277. +              
  2278. +               StringTokenizer st = new StringTokenizer(_command, " ");
  2279. +               st.nextToken();
  2280. +               if (!st.hasMoreTokens())
  2281. +               {
  2282. +                   showDressMeMainPage(activeChar);
  2283. +                   return;
  2284. +               }
  2285. +               int page = Integer.parseInt(st.nextToken());
  2286. +              
  2287. +               if (!st.hasMoreTokens())
  2288. +               {
  2289. +                   showDressMeMainPage(activeChar);
  2290. +                   return;
  2291. +               }
  2292. +               String next = st.nextToken();
  2293. +               if (next.startsWith("skinlist"))
  2294. +               {
  2295. +                   String type = st.nextToken();
  2296. +                   showSkinList(activeChar, type, page);
  2297. +               }
  2298. +               else if (next.startsWith("myskinlist"))
  2299. +               {
  2300. +                  
  2301. +                   showMySkinList(activeChar, page);
  2302. +               }
  2303. +               if (next.equals("clean"))
  2304. +               {
  2305. +                   String type = st.nextToken();
  2306. +                  
  2307. +                   if (activeChar.isTryingSkin())
  2308. +                   {
  2309. +                       activeChar.sendMessage("You can't do this while trying a skin.");
  2310. +                       activeChar.sendPacket(new ExShowScreenMessage("You can't do this while trying a skin.", 2000, 2, false));
  2311. +                       activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2312. +                       showDressMeMainPage(activeChar);
  2313. +                       return;
  2314. +                   }
  2315. +                  
  2316. +                   switch (type.toLowerCase())
  2317. +                   {
  2318. +                       case "armor":
  2319. +                           activeChar.setArmorSkinOption(0);
  2320. +                           break;
  2321. +                       case "weapon":
  2322. +                           activeChar.setWeaponSkinOption(0);
  2323. +                           break;
  2324. +                       case "hair":
  2325. +                           activeChar.setHairSkinOption(0);
  2326. +                           break;
  2327. +                       case "face":
  2328. +                           activeChar.setFaceSkinOption(0);
  2329. +                           break;
  2330. +                       case "shield":
  2331. +                           activeChar.setShieldSkinOption(0);
  2332. +                           break;
  2333. +                   }
  2334. +                  
  2335. +                   activeChar.broadcastUserInfo();
  2336. +                   showMySkinList(activeChar, page);
  2337. +               }
  2338. +               else if (next.startsWith("buyskin"))
  2339. +               {
  2340. +                   if (!st.hasMoreTokens())
  2341. +                   {
  2342. +                       showDressMeMainPage(activeChar);
  2343. +                       return;
  2344. +                   }
  2345. +                  
  2346. +                   int skinId = Integer.parseInt(st.nextToken());
  2347. +                   String type = st.nextToken();
  2348. +                   int itemId = Integer.parseInt(st.nextToken());
  2349. +                  
  2350. +                   SkinPackage sp = null;
  2351. +                  
  2352. +                   switch (type.toLowerCase())
  2353. +                   {
  2354. +                       case "armor":
  2355. +                           sp = DressMeData.getInstance().getArmorSkinsPackage(skinId);
  2356. +                           break;
  2357. +                       case "weapon":
  2358. +                           sp = DressMeData.getInstance().getWeaponSkinsPackage(skinId);
  2359. +                          
  2360. +                           if (activeChar.getActiveWeaponItem() == null)
  2361. +                           {
  2362. +                               activeChar.sendMessage("You can't buy this skin without a weapon.");
  2363. +                               activeChar.sendPacket(new ExShowScreenMessage("You can't buy this skin without a weapon.", 2000, 2, false));
  2364. +                               activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2365. +                               showSkinList(activeChar, type, page);
  2366. +                               return;
  2367. +                           }
  2368. +                          
  2369. +                           ItemInstance skinWeapon = null;
  2370. +                           if (ItemTable.getInstance().getTemplate(itemId) != null)
  2371. +                           {
  2372. +                               skinWeapon = ItemTable.getInstance().createDummyItem(itemId);
  2373. +                              
  2374. +                               if (!checkWeapons(activeChar, skinWeapon, WeaponType.BOW, WeaponType.BOW) //
  2375. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.SWORD, WeaponType.SWORD) //
  2376. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BLUNT, WeaponType.BLUNT) //
  2377. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DAGGER, WeaponType.DAGGER) //
  2378. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.POLE, WeaponType.POLE) //
  2379. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DUAL, WeaponType.DUAL) //
  2380. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DUALFIST, WeaponType.DUALFIST) //
  2381. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BIGSWORD, WeaponType.BIGSWORD) //
  2382. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.FIST, WeaponType.FIST) //
  2383. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT))
  2384. +                               {
  2385. +                                   activeChar.sendMessage("This skin is not suitable for your weapon type.");
  2386. +                                   activeChar.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000, 2, false));
  2387. +                                   activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2388. +                                   showSkinList(activeChar, type, page);
  2389. +                                   return;
  2390. +                               }
  2391. +                           }
  2392. +                           break;
  2393. +                       case "hair":
  2394. +                           sp = DressMeData.getInstance().getHairSkinsPackage(skinId);
  2395. +                           break;
  2396. +                       case "face":
  2397. +                           sp = DressMeData.getInstance().getFaceSkinsPackage(skinId);
  2398. +                           break;
  2399. +                       case "shield":
  2400. +                           sp = DressMeData.getInstance().getShieldSkinsPackage(skinId);
  2401. +                           if (activeChar.getActiveWeaponItem() == null)
  2402. +                           {
  2403. +                               activeChar.sendMessage("You can't buy this skin without a weapon.");
  2404. +                               activeChar.sendPacket(new ExShowScreenMessage("You can't buy this skin without a weapon.", 2000, 2, false));
  2405. +                               activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2406. +                               showSkinList(activeChar, type, page);
  2407. +                               return;
  2408. +                           }
  2409. +                          
  2410. +                           ItemInstance skinShield = null;
  2411. +                           if (ItemTable.getInstance().getTemplate(itemId) != null)
  2412. +                           {
  2413. +                               skinShield = ItemTable.getInstance().createDummyItem(itemId);
  2414. +                              
  2415. +                               if (!checkWeapons(activeChar, skinShield, WeaponType.BOW, WeaponType.BOW) //
  2416. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.POLE, WeaponType.POLE) //
  2417. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.DUAL, WeaponType.DUAL) //
  2418. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.DUALFIST, WeaponType.DUALFIST) //
  2419. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.BIGSWORD, WeaponType.BIGSWORD) //
  2420. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.FIST, WeaponType.FIST) //
  2421. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT))
  2422. +                               {
  2423. +                                   activeChar.sendMessage("This skin is not suitable for your weapon type.");
  2424. +                                   activeChar.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000, 2, false));
  2425. +                                   activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2426. +                                   showSkinList(activeChar, type, page);
  2427. +                                   return;
  2428. +                               }
  2429. +                           }
  2430. +                           break;
  2431. +                   }
  2432. +                  
  2433. +                   if (sp == null)
  2434. +                   {
  2435. +                       activeChar.sendMessage("There is no such skin.");
  2436. +                       activeChar.sendPacket(new ExShowScreenMessage("There is no such skin.", 2000, 2, false));
  2437. +                       activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2438. +                       showSkinList(activeChar, type, page);
  2439. +                       return;
  2440. +                   }
  2441. +                  
  2442. +                  
  2443. +                   if (activeChar.destroyItemByItemId("dressme", sp.getPriceId(), sp.getPriceCount(), activeChar, true))
  2444. +                   {
  2445. +                       activeChar.sendMessage("You have successfully purchased " + sp.getName() + " skin.");
  2446. +                       activeChar.sendPacket(new ExShowScreenMessage("You have successfully purchased " + sp.getName() + " skin.", 2000, 2, false));
  2447. +                      
  2448. +                       switch (type.toLowerCase())
  2449. +                       {
  2450. +                           case "armor":
  2451. +                               activeChar.buyArmorSkin(skinId);
  2452. +                               activeChar.setArmorSkinOption(skinId);
  2453. +                               break;
  2454. +                           case "weapon":
  2455. +                               activeChar.buyWeaponSkin(skinId);
  2456. +                               activeChar.setWeaponSkinOption(skinId);
  2457. +                               break;
  2458. +                           case "hair":
  2459. +                               activeChar.buyHairSkin(skinId);
  2460. +                               activeChar.setHairSkinOption(skinId);
  2461. +                               break;
  2462. +                           case "face":
  2463. +                               activeChar.buyFaceSkin(skinId);
  2464. +                               activeChar.setFaceSkinOption(skinId);
  2465. +                               break;
  2466. +                           case "shield":
  2467. +                               activeChar.buyShieldSkin(skinId);
  2468. +                               activeChar.setShieldSkinOption(skinId);
  2469. +                               break;
  2470. +                       }
  2471. +                      
  2472. +                       activeChar.broadcastUserInfo();
  2473. +                   }
  2474. +                   showSkinList(activeChar, type, page);
  2475. +               }
  2476. +               else if (next.startsWith("tryskin"))
  2477. +               {
  2478. +                  
  2479. +                   int skinId = Integer.parseInt(st.nextToken());
  2480. +                  
  2481. +                   String type = st.nextToken();
  2482. +                  
  2483. +                   if (activeChar.isTryingSkin())
  2484. +                   {
  2485. +                       activeChar.sendMessage("You are already trying a skin.");
  2486. +                       activeChar.sendPacket(new ExShowScreenMessage("You are already trying a skin.", 2000, 2, false));
  2487. +                       activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2488. +                       showSkinList(activeChar, type, page);
  2489. +                       return;
  2490. +                   }
  2491. +                  
  2492. +                   activeChar.setIsTryingSkin(true);
  2493. +                  
  2494. +                   int oldArmorSkinId = activeChar.getArmorSkinOption();
  2495. +                   int oldWeaponSkinId = activeChar.getWeaponSkinOption();
  2496. +                   int oldHairSkinId = activeChar.getHairSkinOption();
  2497. +                   int oldFaceSkinId = activeChar.getFaceSkinOption();
  2498. +                   int oldShieldSkinId = activeChar.getShieldSkinOption();
  2499. +                  
  2500. +                   switch (type.toLowerCase())
  2501. +                   {
  2502. +                       case "armor":
  2503. +                           activeChar.setArmorSkinOption(skinId);
  2504. +                           break;
  2505. +                       case "weapon":
  2506. +                           activeChar.setWeaponSkinOption(skinId);
  2507. +                           break;
  2508. +                       case "hair":
  2509. +                           activeChar.setHairSkinOption(skinId);
  2510. +                           break;
  2511. +                       case "face":
  2512. +                           activeChar.setFaceSkinOption(skinId);
  2513. +                           break;
  2514. +                       case "shield":
  2515. +                          
  2516. +                           activeChar.setShieldSkinOption(skinId);
  2517. +                          
  2518. +                           break;
  2519. +                   }
  2520. +                  
  2521. +                   activeChar.broadcastUserInfo();
  2522. +                   showSkinList(activeChar, type, page);
  2523. +                  
  2524. +                   ThreadPool.schedule(() ->
  2525. +                   {
  2526. +                       switch (type.toLowerCase())
  2527. +                       {
  2528. +                           case "armor":
  2529. +                               activeChar.setArmorSkinOption(oldArmorSkinId);
  2530. +                               break;
  2531. +                           case "weapon":
  2532. +                               activeChar.setWeaponSkinOption(oldWeaponSkinId);
  2533. +                               break;
  2534. +                           case "hair":
  2535. +                               activeChar.setHairSkinOption(oldHairSkinId);
  2536. +                               break;
  2537. +                           case "face":
  2538. +                               activeChar.setFaceSkinOption(oldFaceSkinId);
  2539. +                               break;
  2540. +                           case "shield":
  2541. +                               activeChar.setShieldSkinOption(oldShieldSkinId);
  2542. +                               break;
  2543. +                       }
  2544. +                      
  2545. +                       activeChar.broadcastUserInfo();
  2546. +                       activeChar.setIsTryingSkin(false);
  2547. +                   }, 5000);
  2548. +               }
  2549. +               else if (next.startsWith("setskin"))
  2550. +               {
  2551. +                   int id = Integer.parseInt(st.nextToken());
  2552. +                   String type = st.nextToken();
  2553. +                   int itemId = Integer.parseInt(st.nextToken());
  2554. +                  
  2555. +                   if (activeChar.isTryingSkin())
  2556. +                   {
  2557. +                       activeChar.sendMessage("You can't do this while trying skins.");
  2558. +                       activeChar.sendPacket(new ExShowScreenMessage("You can't do this while trying skins.", 2000, 2, false));
  2559. +                       activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2560. +                       showMySkinList(activeChar, page);
  2561. +                       return;
  2562. +                   }
  2563. +                  
  2564. +                   if (type.toLowerCase().contains("armor") && activeChar.hasEquippedArmorSkin(String.valueOf(id)) || type.toLowerCase().contains("weapon") && activeChar.hasEquippedWeaponSkin(String.valueOf(id))
  2565. +                       || type.toLowerCase().contains("hair") && activeChar.hasEquippedHairSkin(String.valueOf(id)) || type.toLowerCase().contains("face") && activeChar.hasEquippedFaceSkin(String.valueOf(id)))
  2566. +                   {
  2567. +                       activeChar.sendMessage("You are already equipped this skin.");
  2568. +                       activeChar.sendPacket(new ExShowScreenMessage("You are already equipped this skin.", 2000, 2, false));
  2569. +                       activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2570. +                       showMySkinList(activeChar, page);
  2571. +                       return;
  2572. +                   }
  2573. +                  
  2574. +                   switch (type.toLowerCase())
  2575. +                   {
  2576. +                       case "armor":
  2577. +                           activeChar.setArmorSkinOption(id);
  2578. +                           break;
  2579. +                       case "weapon":
  2580. +                           if (activeChar.getActiveWeaponItem() == null)
  2581. +                           {
  2582. +                               activeChar.sendMessage("You can't use this skin without a weapon.");
  2583. +                               activeChar.sendPacket(new ExShowScreenMessage("You can't use this skin without a weapon.", 2000, 2, false));
  2584. +                               activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2585. +                               showMySkinList(activeChar, page);
  2586. +                               return;
  2587. +                           }
  2588. +                          
  2589. +                           ItemInstance skinWeapon = null;
  2590. +                           if (ItemTable.getInstance().getTemplate(itemId) != null)
  2591. +                           {
  2592. +                               skinWeapon = ItemTable.getInstance().createDummyItem(itemId);
  2593. +                              
  2594. +                               if (!checkWeapons(activeChar, skinWeapon, WeaponType.BOW, WeaponType.BOW) //
  2595. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.SWORD, WeaponType.SWORD) //
  2596. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BLUNT, WeaponType.BLUNT) //
  2597. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DAGGER, WeaponType.DAGGER) //
  2598. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.POLE, WeaponType.POLE) //
  2599. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DUAL, WeaponType.DUAL) //
  2600. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.DUALFIST, WeaponType.DUALFIST) //
  2601. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BIGSWORD, WeaponType.BIGSWORD) //
  2602. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.FIST, WeaponType.FIST) //
  2603. +                                   || !checkWeapons(activeChar, skinWeapon, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT))
  2604. +                               {
  2605. +                                   activeChar.sendMessage("This skin is not suitable for your weapon type.");
  2606. +                                   activeChar.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000, 2, false));
  2607. +                                   activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2608. +                                   showMySkinList(activeChar, page);
  2609. +                                   return;
  2610. +                               }
  2611. +                              
  2612. +                               activeChar.setWeaponSkinOption(id);
  2613. +                           }
  2614. +                           break;
  2615. +                       case "hair":
  2616. +                           activeChar.setHairSkinOption(id);
  2617. +                           break;
  2618. +                       case "face":
  2619. +                           activeChar.setFaceSkinOption(id);
  2620. +                           break;
  2621. +                       case "shield":
  2622. +                           if (activeChar.getActiveWeaponItem() == null)
  2623. +                           {
  2624. +                               activeChar.sendMessage("You can't use this skin without a weapon.");
  2625. +                               activeChar.sendPacket(new ExShowScreenMessage("You can't use this skin without a weapon.", 2000, 2, false));
  2626. +                               activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2627. +                               showMySkinList(activeChar, page);
  2628. +                               return;
  2629. +                           }
  2630. +                          
  2631. +                           ItemInstance skinShield = null;
  2632. +                           if (ItemTable.getInstance().getTemplate(itemId) != null)
  2633. +                           {
  2634. +                               skinShield = ItemTable.getInstance().createDummyItem(itemId);
  2635. +                              
  2636. +                               if (!checkWeapons(activeChar, skinShield, WeaponType.BOW, WeaponType.BOW) //
  2637. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.POLE, WeaponType.POLE) //
  2638. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.DUAL, WeaponType.DUAL) //
  2639. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.DUALFIST, WeaponType.DUALFIST) //
  2640. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.BIGSWORD, WeaponType.BIGSWORD) //
  2641. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.FIST, WeaponType.FIST) //
  2642. +                                   || !checkWeapons(activeChar, skinShield, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT))
  2643. +                               {
  2644. +                                   activeChar.sendMessage("This skin is not suitable for your weapon type.");
  2645. +                                   activeChar.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000, 2, false));
  2646. +                                   activeChar.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
  2647. +                                   showMySkinList(activeChar, page);
  2648. +                                   return;
  2649. +                               }
  2650. +                              
  2651. +                               activeChar.setShieldSkinOption(id);
  2652. +                           }
  2653. +                          
  2654. +                           break;
  2655. +                   }
  2656. +                  
  2657. +                   activeChar.broadcastUserInfo();
  2658. +                   showMySkinList(activeChar, page);
  2659. +               }
  2660. +  
  2661. +          
  2662. +           }      
  2663. +          
  2664. +          
  2665. +          
  2666. +          
  2667. +          
  2668. +          
  2669.             else if (_command.startsWith("_match"))
  2670.             {
  2671.                 String params = _command.substring(_command.indexOf("?") + 1);
  2672. @@ -193,6 +622,267 @@
  2673.         }
  2674.     }
  2675.    
  2676. +  
  2677. +   public static String getItemNameById(int itemId)
  2678. +   {
  2679. +       Item item = ItemTable.getInstance().getTemplate(itemId);
  2680. +      
  2681. +       String itemName = "NoName";
  2682. +      
  2683. +       if (itemId != 0)
  2684. +       {
  2685. +           itemName = item.getName();
  2686. +       }
  2687. +      
  2688. +       return itemName;
  2689. +   }
  2690. +  
  2691. +  
  2692. +   public static void showDressMeMainPage(Player player)
  2693. +   {
  2694. +       NpcHtmlMessage htm = new NpcHtmlMessage(1);
  2695. +       String text = HtmCache.getInstance().getHtm("data/html/dressme/index.htm");
  2696. +      
  2697. +       htm.setHtml(text);
  2698. +      
  2699. +       {
  2700. +           htm.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
  2701. +           htm.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
  2702. +          
  2703. +       }
  2704. +      
  2705. +       player.sendPacket(htm);
  2706. +   }
  2707. +  
  2708. +   static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  2709. +  
  2710. +   private static void showSkinList(Player player, String type, int page)
  2711. +   {
  2712. +       NpcHtmlMessage html = new NpcHtmlMessage(1);
  2713. +      
  2714. +       html.setFile("data/html/dressme/allskins.htm");
  2715. +      
  2716. +       html.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
  2717. +       html.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
  2718. +      
  2719. +       final int ITEMS_PER_PAGE = 8;
  2720. +      
  2721. +       int myPage = 1;
  2722. +       int i = 0;
  2723. +       int shown = 0;
  2724. +       boolean hasMore = false;
  2725. +       int itemId = 0;
  2726. +      
  2727. +       final StringBuilder sb = new StringBuilder();
  2728. +      
  2729. +       List<SkinPackage> tempList = null;
  2730. +       switch (type.toLowerCase())
  2731. +       {
  2732. +           case "armor":
  2733. +               tempList = DressMeData.getInstance().getArmorSkinOptions().values().stream().filter(s -> !player.hasArmorSkin(s.getId())).collect(Collectors.toList());
  2734. +               break;
  2735. +           case "weapon":
  2736. +               tempList = DressMeData.getInstance().getWeaponSkinOptions().values().stream().filter(s -> !player.hasWeaponSkin(s.getId())).collect(Collectors.toList());
  2737. +               break;
  2738. +           case "hair":
  2739. +               tempList = DressMeData.getInstance().getHairSkinOptions().values().stream().filter(s -> !player.hasHairSkin(s.getId())).collect(Collectors.toList());
  2740. +               break;
  2741. +           case "face":
  2742. +               tempList = DressMeData.getInstance().getFaceSkinOptions().values().stream().filter(s -> !player.hasFaceSkin(s.getId())).collect(Collectors.toList());
  2743. +               break;
  2744. +           case "shield":
  2745. +               tempList = DressMeData.getInstance().getShieldSkinOptions().values().stream().filter(s -> !player.hasShieldSkin(s.getId())).collect(Collectors.toList());
  2746. +               break;
  2747. +       }
  2748. +      
  2749. +       if (tempList != null && !tempList.isEmpty())
  2750. +       {
  2751. +           for (SkinPackage sp : tempList)
  2752. +           {
  2753. +               if (sp == null)
  2754. +               {
  2755. +                   continue;
  2756. +               }
  2757. +              
  2758. +               if (shown == ITEMS_PER_PAGE)
  2759. +               {
  2760. +                   hasMore = true;
  2761. +                   break;
  2762. +               }
  2763. +              
  2764. +               if (myPage != page)
  2765. +               {
  2766. +                   i++;
  2767. +                   if (i == ITEMS_PER_PAGE)
  2768. +                   {
  2769. +                       myPage++;
  2770. +                       i = 0;
  2771. +                   }
  2772. +                   continue;
  2773. +               }
  2774. +              
  2775. +               if (shown == ITEMS_PER_PAGE)
  2776. +               {
  2777. +                   hasMore = true;
  2778. +                   break;
  2779. +               }
  2780. +              
  2781. +               switch (type.toLowerCase())
  2782. +               {
  2783. +                   case "armor":
  2784. +                       itemId = sp.getChestId();
  2785. +                       break;
  2786. +                   case "weapon":
  2787. +                       itemId = sp.getWeaponId();
  2788. +                       break;
  2789. +                   case "hair":
  2790. +                       itemId = sp.getHairId();
  2791. +                       break;
  2792. +                   case "face":
  2793. +                       itemId = sp.getFaceId();
  2794. +                       break;
  2795. +                   case "shield":
  2796. +                       itemId = sp.getShieldId();
  2797. +                       break;
  2798. +               }
  2799. +              
  2800. +               sb.append("<table border=0 cellspacing=0 cellpadding=2 height=36><tr>");
  2801. +               sb.append("<td width=32 align=center>" + "<button width=32 height=32 back=" + Item.getItemIcon(itemId) + " fore=" + Item.getItemIcon(itemId) + ">" + "</td>");
  2802. +               sb.append("<td width=124>" + sp.getName() + "<br1> <font color=999999>Price:</font> <font color=339966>" + Item.getItemNameById(sp.getPriceId()) + "</font> (<font color=LEVEL>" + sp.getPriceCount() + "</font>)</td>");
  2803. +               sb.append("<td align=center width=65>" + "<button value=\"Buy\" action=\"bypass -h dressme " + page + " buyskin  " + sp.getId() + " " + type + " " + itemId + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
  2804. +               sb.append("<td align=center width=65>" + "<button value=\"Try\" action=\"bypass -h dressme " + page + " tryskin  " + sp.getId() + " " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
  2805. +              
  2806. +               sb.append("</tr></table>");
  2807. +               sb.append("<img src=\"L2UI.Squaregray\" width=\"300\" height=\"1\">");
  2808. +               shown++;
  2809. +           }
  2810. +       }
  2811. +      
  2812. +       sb.append("<table width=300><tr>");
  2813. +       sb.append("<td align=center width=70>" + (page > 1 ? "<button value=\"< PREV\" action=\"bypass -h dressme " + (page - 1) + " skinlist " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
  2814. +       sb.append("<td align=center width=140>Page: " + page + "</td>");
  2815. +       sb.append("<td align=center width=70>" + (hasMore ? "<button value=\"NEXT >\" action=\"bypass -h dressme " + (page + 1) + " skinlist " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
  2816. +       sb.append("</tr></table>");
  2817. +      
  2818. +       html.replace("%showList%", sb.toString());
  2819. +       player.sendPacket(html);
  2820. +   }
  2821. +  
  2822. +   private static void showMySkinList(Player player, int page)
  2823. +   {
  2824. +       NpcHtmlMessage html = new NpcHtmlMessage(1);
  2825. +       html.setFile("data/html/dressme/myskins.htm");
  2826. +      
  2827. +       html.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
  2828. +       html.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
  2829. +      
  2830. +       final int ITEMS_PER_PAGE = 8;
  2831. +       int itemId = 0;
  2832. +      
  2833. +       int myPage = 1;
  2834. +       int i = 0;
  2835. +       int shown = 0;
  2836. +       boolean hasMore = false;
  2837. +      
  2838. +       final StringBuilder sb = new StringBuilder();
  2839. +      
  2840. +       List<SkinPackage> armors = DressMeData.getInstance().getArmorSkinOptions().values().stream().filter(s -> player.hasArmorSkin(s.getId())).collect(Collectors.toList());
  2841. +       List<SkinPackage> weapons = DressMeData.getInstance().getWeaponSkinOptions().values().stream().filter(s -> player.hasWeaponSkin(s.getId())).collect(Collectors.toList());
  2842. +       List<SkinPackage> hairs = DressMeData.getInstance().getHairSkinOptions().values().stream().filter(s -> player.hasHairSkin(s.getId())).collect(Collectors.toList());
  2843. +       // List<SkinPackage> faces = DressMeData.getInstance().getFaceSkinOptions().values().stream().filter(s -> player.hasFaceSkin(s.getId())).collect(Collectors.toList());
  2844. +       List<SkinPackage> shield = DressMeData.getInstance().getShieldSkinOptions().values().stream().filter(s -> player.hasShieldSkin(s.getId())).collect(Collectors.toList());
  2845. +      
  2846. +       List<SkinPackage> list = Stream.concat(armors.stream(), weapons.stream()).collect(Collectors.toList());
  2847. +       shield.stream().collect(Collectors.toList());
  2848. +       List<SkinPackage> list2 = Stream.concat(hairs.stream(), shield.stream()).collect(Collectors.toList());
  2849. +      
  2850. +       List<SkinPackage> allLists = Stream.concat(list.stream(), list2.stream()).collect(Collectors.toList());
  2851. +      
  2852. +       if (!allLists.isEmpty())
  2853. +       {
  2854. +           for (SkinPackage sp : allLists)
  2855. +           {
  2856. +               if (sp == null)
  2857. +               {
  2858. +                   continue;
  2859. +               }
  2860. +              
  2861. +               if (shown == ITEMS_PER_PAGE)
  2862. +               {
  2863. +                   hasMore = true;
  2864. +                   break;
  2865. +               }
  2866. +              
  2867. +               if (myPage != page)
  2868. +               {
  2869. +                   i++;
  2870. +                   if (i == ITEMS_PER_PAGE)
  2871. +                   {
  2872. +                       myPage++;
  2873. +                       i = 0;
  2874. +                   }
  2875. +                   continue;
  2876. +               }
  2877. +              
  2878. +               if (shown == ITEMS_PER_PAGE)
  2879. +               {
  2880. +                   hasMore = true;
  2881. +                   break;
  2882. +               }
  2883. +              
  2884. +               switch (sp.getType().toLowerCase())
  2885. +               {
  2886. +                   case "armor":
  2887. +                       itemId = sp.getChestId();
  2888. +                       break;
  2889. +                   case "weapon":
  2890. +                       itemId = sp.getWeaponId();
  2891. +                       break;
  2892. +                   case "hair":
  2893. +                       itemId = sp.getHairId();
  2894. +                       break;
  2895. +                   case "face":
  2896. +                       itemId = sp.getFaceId();
  2897. +                       break;
  2898. +                   case "shield":
  2899. +                       itemId = sp.getShieldId();
  2900. +                       break;
  2901. +               }
  2902. +              
  2903. +               sb.append("<table border=0 cellspacing=0 cellpadding=2 height=36><tr>");
  2904. +               sb.append("<td width=32 align=center>" + "<button width=32 height=32 back=" + Item.getItemIcon(itemId) + " fore=" + Item.getItemIcon(itemId) + ">" + "</td>");
  2905. +               sb.append("<td width=124>" + sp.getName() + "</td>");
  2906. +               sb.append("<td align=center width=65>" + "<button value=\"Equip\" action=\"bypass -h dressme " + page + " setskin " + sp.getId() + " " + sp.getType() + " " + itemId + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
  2907. +               sb.append("<td align=center width=65>" + "<button value=\"Remove\" action=\"bypass -h dressme " + page + " clean " + sp.getType() + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
  2908. +               sb.append("</tr></table>");
  2909. +               sb.append("<img src=\"L2UI.Squaregray\" width=\"300\" height=\"1\">");
  2910. +               shown++;
  2911. +           }
  2912. +       }
  2913. +      
  2914. +       sb.append("<table width=300><tr>");
  2915. +       sb.append("<td align=center width=70>" + (page > 1 ? "<button value=\"< PREV\" action=\"bypass -h dressme " + (page - 1) + " myskinlist\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
  2916. +       sb.append("<td align=center width=140>Page: " + page + "</td>");
  2917. +       sb.append("<td align=center width=70>" + (hasMore ? "<button value=\"NEXT >\" action=\"bypass -h dressme " + (page + 1) + " myskinlist\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
  2918. +       sb.append("</tr></table>");
  2919. +      
  2920. +       html.replace("%showList%", sb.toString());
  2921. +       player.sendPacket(html);
  2922. +   }
  2923. +  
  2924. +   public static boolean checkWeapons(Player player, ItemInstance skin, WeaponType weapon1, WeaponType weapon2)
  2925. +   {
  2926. +       if (player.getActiveWeaponItem().getItemType() == weapon1 && skin.getItem().getItemType() != weapon2)
  2927. +       {
  2928. +           return false;
  2929. +       }
  2930. +      
  2931. +       return true;
  2932. +   }      
  2933. +  
  2934. +  
  2935. +  
  2936. +  
  2937.     private static void playerHelp(Player activeChar, String path)
  2938.     {
  2939.         if (path.indexOf("..") != -1)
  2940. diff --git java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
  2941. index 1704550..0c8919b 100644
  2942. --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
  2943. +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
  2944. @@ -8,6 +8,9 @@
  2945.  import net.sf.l2j.gameserver.model.location.Location;
  2946.  import net.sf.l2j.gameserver.skills.AbnormalEffect;
  2947.  
  2948. +import Base.Skin.DressMeData;
  2949. +import Base.Skin.SkinPackage;
  2950. +
  2951.  public class CharInfo extends L2GameServerPacket
  2952.  {
  2953.     private final Player _activeChar;
  2954. @@ -46,19 +49,84 @@
  2955.         else
  2956.             writeD(_activeChar.getBaseClass());
  2957.        
  2958.         writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIRALL));
  2959.         writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  2960. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2961. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  2962. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  2963. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  2964. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  2965. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  2966. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  2967. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2968. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  2969. -       writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  2970. -      
  2971. +       if (Config.ALLOW_DRESS_ME_SYSTEM)
  2972. +       {
  2973. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  2974. +           {
  2975. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2976. +           }
  2977. +           else
  2978. +           {
  2979. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2980. +           }
  2981. +          
  2982. +           if (_activeChar.getShieldSkinOption() > 0 && getShieldOption(_activeChar.getShieldSkinOption()) != null)
  2983. +           {
  2984. +               writeD(getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  2985. +           }
  2986. +           else
  2987. +           {
  2988. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  2989. +           }
  2990. +          
  2991. +           if (_activeChar.getArmorSkinOption() > 0 && getArmorOption(_activeChar.getArmorSkinOption()) != null)
  2992. +           {
  2993. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  2994. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getChestId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  2995. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  2996. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  2997. +           }
  2998. +           else
  2999. +           {
  3000. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3001. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3002. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3003. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3004. +           }
  3005. +          
  3006. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  3007. +          
  3008. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  3009. +           {
  3010. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3011. +           }
  3012. +           else
  3013. +           {
  3014. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3015. +           }
  3016. +          
  3017. +           if (_activeChar.getHairSkinOption() > 0 && getHairOption(_activeChar.getHairSkinOption()) != null)
  3018. +           {
  3019. +               writeD(getHairOption(_activeChar.getHairSkinOption()).getHairId() != 0 ? getHairOption(_activeChar.getHairSkinOption()).getHairId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3020. +           }
  3021. +           else
  3022. +           {
  3023. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3024. +           }
  3025. +          
  3026. +           if (_activeChar.getFaceSkinOption() > 0 && getFaceOption(_activeChar.getFaceSkinOption()) != null)
  3027. +           {
  3028. +               writeD(getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3029. +           }
  3030. +           else
  3031. +           {
  3032. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3033. +           }
  3034. +          
  3035. +       }
  3036. +       else
  3037. +       {
  3038. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3039. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  3040. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3041. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3042. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3043. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3044. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  3045. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3046. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3047. +           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3048. +       }
  3049.         // c6 new h's
  3050.         writeH(0x00);
  3051.         writeH(0x00);
  3052. @@ -206,4 +274,30 @@
  3053.         else
  3054.             writeD(0x00);
  3055.     }
  3056. +  
  3057. +   public SkinPackage getArmorOption(int option)
  3058. +{
  3059. +   return (DressMeData.getInstance().getArmorSkinsPackage(option));
  3060. +}
  3061. +
  3062. +public SkinPackage getWeaponOption(int option)
  3063. +{
  3064. +   return DressMeData.getInstance().getWeaponSkinsPackage(option);
  3065. +}
  3066. +
  3067. +public SkinPackage getHairOption(int option)
  3068. +{
  3069. +   return DressMeData.getInstance().getHairSkinsPackage(option);
  3070. +}
  3071. +
  3072. +public SkinPackage getFaceOption(int option)
  3073. +{
  3074. +   return DressMeData.getInstance().getFaceSkinsPackage(option);
  3075. +}
  3076. +
  3077. +public SkinPackage getShieldOption(int option)
  3078. +{
  3079. +   return DressMeData.getInstance().getShieldSkinsPackage(option);
  3080. +}     
  3081. +  
  3082.  }
  3083. \ No newline at end of file
  3084. diff --git java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
  3085. index deef1da..11835ce 100644
  3086. --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
  3087. +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
  3088. @@ -9,6 +9,9 @@
  3089.  import net.sf.l2j.gameserver.model.location.Location;
  3090.  import net.sf.l2j.gameserver.skills.AbnormalEffect;
  3091.  
  3092. +import Base.Skin.DressMeData;
  3093. +import Base.Skin.SkinPackage;
  3094. +
  3095.  public class UserInfo extends L2GameServerPacket
  3096.  {
  3097.     private final Player _activeChar;
  3098. @@ -72,16 +75,84 @@
  3099.         writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER));
  3100.         writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER));
  3101.         writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD));
  3102. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3103. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  3104. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  3105. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  3106. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  3107. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  3108. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  3109. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3110. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  3111. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  3112. +       if (Config.ALLOW_DRESS_ME_SYSTEM)
  3113. +       {
  3114. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  3115. +           {
  3116. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3117. +           }
  3118. +           else
  3119. +           {
  3120. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3121. +           }
  3122. +          
  3123. +           if (_activeChar.getShieldSkinOption() > 0 && getShieldOption(_activeChar.getShieldSkinOption()) != null)
  3124. +           {
  3125. +               writeD(getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  3126. +           }
  3127. +           else
  3128. +           {
  3129. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  3130. +           }
  3131. +          
  3132. +           if (_activeChar.getArmorSkinOption() > 0 && getArmorOption(_activeChar.getArmorSkinOption()) != null)
  3133. +           {
  3134. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  3135. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getChestId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  3136. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  3137. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  3138. +           }
  3139. +           else
  3140. +           {
  3141. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  3142. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  3143. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  3144. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  3145. +           }
  3146. +          
  3147. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  3148. +          
  3149. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  3150. +           {
  3151. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3152. +           }
  3153. +           else
  3154. +           {
  3155. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3156. +           }
  3157. +          
  3158. +           if (_activeChar.getHairSkinOption() > 0 && getHairOption(_activeChar.getHairSkinOption()) != null)
  3159. +           {
  3160. +               writeD(getHairOption(_activeChar.getHairSkinOption()).getHairId() != 0 ? getHairOption(_activeChar.getHairSkinOption()).getHairId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  3161. +           }
  3162. +           else
  3163. +           {
  3164. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  3165. +           }
  3166. +          
  3167. +           if (_activeChar.getFaceSkinOption() > 0 && getFaceOption(_activeChar.getFaceSkinOption()) != null)
  3168. +           {
  3169. +               writeD(getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  3170. +           }
  3171. +           else
  3172. +           {
  3173. +               writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  3174. +           }
  3175. +          
  3176. +       }
  3177. +       else
  3178. +       {
  3179. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3180. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  3181. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  3182. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  3183. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  3184. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  3185. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  3186. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  3187. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  3188. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  3189. +       }
  3190.        
  3191.         writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIRALL));
  3192.         writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR));
  3193. @@ -90,16 +161,85 @@
  3194.         writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
  3195.         writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
  3196.         writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  3197. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3198. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  3199. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3200. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3201. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3202. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3203. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  3204. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3205. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3206. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3207. +      
  3208. +       if (Config.ALLOW_DRESS_ME_SYSTEM)
  3209. +       {
  3210. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  3211. +           {
  3212. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3213. +           }
  3214. +           else
  3215. +           {
  3216. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3217. +           }
  3218. +          
  3219. +           if (_activeChar.getShieldSkinOption() > 0 && getShieldOption(_activeChar.getShieldSkinOption()) != null)
  3220. +           {
  3221. +               writeD(getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_activeChar.getShieldSkinOption()).getShieldId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  3222. +           }
  3223. +           else
  3224. +           {
  3225. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  3226. +           }
  3227. +          
  3228. +           if (_activeChar.getArmorSkinOption() > 0 && getArmorOption(_activeChar.getArmorSkinOption()) != null)
  3229. +           {
  3230. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getGlovesId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3231. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getChestId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3232. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getLegsId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3233. +               writeD(getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_activeChar.getArmorSkinOption()).getFeetId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3234. +           }
  3235. +           else
  3236. +           {
  3237. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3238. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3239. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3240. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3241. +           }
  3242. +          
  3243. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  3244. +          
  3245. +           if (_activeChar.getWeaponSkinOption() > 0 && getWeaponOption(_activeChar.getWeaponSkinOption()) != null)
  3246. +           {
  3247. +               writeD(getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_activeChar.getWeaponSkinOption()).getWeaponId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3248. +           }
  3249. +           else
  3250. +           {
  3251. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3252. +           }
  3253. +          
  3254. +           if (_activeChar.getHairSkinOption() > 0 && getHairOption(_activeChar.getHairSkinOption()) != null)
  3255. +           {
  3256. +               writeD(getHairOption(_activeChar.getHairSkinOption()).getHairId() != 0 ? getHairOption(_activeChar.getHairSkinOption()).getHairId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3257. +           }
  3258. +           else
  3259. +           {
  3260. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3261. +           }
  3262. +          
  3263. +           if (_activeChar.getFaceSkinOption() > 0 && getFaceOption(_activeChar.getFaceSkinOption()) != null)
  3264. +           {
  3265. +               writeD(getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_activeChar.getFaceSkinOption()).getFaceId() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3266. +           }
  3267. +           else
  3268. +           {
  3269. +               writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3270. +           }
  3271. +          
  3272. +       }
  3273. +       else
  3274. +       {
  3275. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3276. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  3277. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  3278. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  3279. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  3280. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  3281. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  3282. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  3283. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  3284. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  3285. +       }
  3286.        
  3287.         // c6 new h's
  3288.         writeH(0x00);
  3289. @@ -265,4 +405,29 @@
  3290.         else
  3291.             writeD(0x00);
  3292.     }
  3293. +  
  3294. +   public SkinPackage getArmorOption(int option)
  3295. +   {
  3296. +       return (DressMeData.getInstance().getArmorSkinsPackage(option));
  3297. +   }
  3298. +  
  3299. +   public SkinPackage getWeaponOption(int option)
  3300. +   {
  3301. +       return DressMeData.getInstance().getWeaponSkinsPackage(option);
  3302. +   }
  3303. +  
  3304. +   public SkinPackage getHairOption(int option)
  3305. +   {
  3306. +       return DressMeData.getInstance().getHairSkinsPackage(option);
  3307. +   }
  3308. +  
  3309. +   public SkinPackage getFaceOption(int option)
  3310. +   {
  3311. +       return DressMeData.getInstance().getFaceSkinsPackage(option);
  3312. +   }
  3313. +  
  3314. +   public SkinPackage getShieldOption(int option)
  3315. +   {
  3316. +       return DressMeData.getInstance().getShieldSkinsPackage(option);
  3317. +   }
  3318.  }
  3319.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement