tensador125

l2j DressMe aCis 401 core

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