Axelut

l2j DressMe aCis 405

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