Advertisement
tensador125

BeautyShop + New System Skin + Skin Item

Apr 13th, 2023
1,341
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 62.30 KB | Gaming | 0 0
  1. diff --git a/cfiles/game/config/main/L2jOrion.ini b/cfiles/game/config/main/L2jOrion.ini
  2. index bf1867e..eddb8e7 100644
  3. --- a/cfiles/game/config/main/L2jOrion.ini
  4. +++ b/cfiles/game/config/main/L2jOrion.ini
  5. @@ -333,4 +333,7 @@
  6.  NewPlayerEffect = False
  7.  
  8.  # It shows Castle's Lord clan crest in town nearby npc name
  9. -ShowNpcCrest = False
  10. \ No newline at end of file
  11. +ShowNpcCrest = False
  12. +
  13. +TextureSkinPackageName = MAYKE_MENDES_SKIN
  14. +TextureSkinSuffixName = _f
  15. \ No newline at end of file
  16. diff --git a/data/html/SkinManager/Main.htm b/data/html/SkinManager/Main.htm
  17. new file mode 100644
  18. index 0000000..c863c08
  19. --- /dev/null
  20. +++ b/data/html/SkinManager/Main.htm
  21. @@ -0,0 +1,31 @@
  22. +<html>
  23. +   <body>
  24. +   <title>Skin Manager</title>
  25. +   <br>
  26. +   <center>
  27. +       <center><img src="L2UI.SquareWhite" width=200 height=1></center>
  28. +<table bgcolor=3c3c3c width=204>
  29. +<tr>
  30. +<td><center><font color="FFFF00">Skin Test / Buy </font></center></td>
  31. +</tr>
  32. +</table></center>
  33. +<center><img src="L2UI.SquareWhite" width=200 height=1></center>
  34. +<br>
  35. +   </center>
  36. +       <table width=300>
  37. +           %skins%<br><br>
  38. +       </table>
  39. +       <center>
  40. +      
  41. +      
  42. +       <table width=270 align=center >
  43. +           <tr>
  44. +          
  45. +               %pages%
  46. +              
  47. +           </tr>
  48. +       </table>
  49. +       </center>
  50. +      
  51. +   </body>
  52. +</html>
  53. \ No newline at end of file
  54. diff --git a/data/html/SkinManager/Skin.htm b/data/html/SkinManager/Skin.htm
  55. new file mode 100644
  56. index 0000000..fb4d8cb
  57. --- /dev/null
  58. +++ b/data/html/SkinManager/Skin.htm
  59. @@ -0,0 +1,52 @@
  60. +<html>
  61. +   <body>
  62. +   <title>Skin Manager</title>
  63. +   <br><br>
  64. +   <center>
  65. +       <font color=LEVEL >SKIN DATA</font>
  66. +      
  67. +   </center>
  68. +       <table width=310 bgcolor=000000 height=80>
  69. +           <tr>
  70. +               <td width=50>
  71. +              
  72. +               </td>
  73. +               <td align=left>
  74. +              
  75. +                   <font color=LEVEL>- Skin Name: </font>
  76. +                   <font color=ff0000> %skiname% </font><br1>
  77. +                   <font color=LEVEL>- Skin Price:</font>
  78. +                   <font color=ff0000> %skinprice% </font>
  79. +                   <font color=87ff26> %skinpriceid% </font>
  80. +                  
  81. +                  
  82. +               </td>
  83. +              
  84. +           </tr>
  85. +      
  86. +       </table>
  87. +      
  88. +       <center><br><br><br>
  89. +       <font color=LEVEL > FUNCTIONS</font>
  90. +      
  91. +   </center>
  92. +      
  93. +       <table width=301 bgcolor=0000 >
  94. +  
  95. +          
  96. +           %showbutton%
  97. +              
  98. +       </table>
  99. +       <center>
  100. +       <table width=310 align=center>
  101. +           <tr>
  102. +               <td align=center><br><br>
  103. +               <button value="Back" action="bypass -h skinPage 1" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal">
  104. +               </td>
  105. +              
  106. +              
  107. +           </tr>
  108. +       </table>
  109. +       </center>
  110. +   </body>
  111. +</html>
  112. \ No newline at end of file
  113. diff --git a/data/xml/Skins.xml b/data/xml/Skins.xml
  114. new file mode 100644
  115. index 0000000..eaeaff8
  116. --- /dev/null
  117. +++ b/data/xml/Skins.xml
  118. @@ -0,0 +1,68 @@
  119. +<?xml version="1.0" encoding="utf-8"?>
  120. +<list>
  121. +<!-- Try Skins  -->
  122. +
  123. +   <skin id="1" name="Anakim Suit" utx_name="anakim" chest="10100" legs="0" gloves="0" feet="0" hair="10101" isVip="0" price_id="3470" price="100">
  124. +
  125. +   </skin>
  126. +  
  127. +   <skin id="2" name="White Knight" utx_name="rei2" chest="10129" legs="0" gloves="0" feet="0" hair="10130" isVip="0"  price_id="3470" price="10">
  128. +
  129. +   </skin>
  130. +  
  131. +   <skin id="3" name="Archer Suit B" utx_name="archer2" chest="10105" legs="0" gloves="0" feet="0" hair="10106" isVip="0"  price_id="3470" price="10">
  132. +
  133. +   </skin>
  134. +  
  135. +   <skin id="4" name="Beleth Suit" utx_name="beleth" chest="10124" legs="0" gloves="0" feet="0" hair="10125" isVip="0"  price_id="3470" price="10">
  136. +
  137. +   </skin>
  138. +  
  139. +   <skin id="5" name="Cat Suit" utx_name="cat" chest="10144" legs="0" gloves="0" feet="0" hair="15017" isVip="0"  price_id="3470" price="10">
  140. +   </skin>
  141. +  
  142. +   <skin id="6" name="CowBoy Suit" utx_name="cowboy" chest="10110" legs="0" gloves="0" feet="0" hair="0" isVip="0"  price_id="3470" price="10">
  143. +   </skin>
  144. +  
  145. +   <skin id="7" name="Cyborg Suit" utx_name="cyborg" chest="10105" legs="0" gloves="0" feet="0" hair="10106" isVip="0"  price_id="3470" price="10">
  146. +   </skin>
  147. +  
  148. +   <skin id="8" name="Dark Assassin Suit" utx_name="dark" chest="10122" legs="0" gloves="0" feet="0" hair="10123" isVip="0"  price_id="3470" price="10">
  149. +   </skin>
  150. +  
  151. +   <skin id="9" name="Dragon Born Suit" utx_name="dragon" chest="10156" legs="0" gloves="0" feet="0" hair="15047" isVip="0"  price_id="3470" price="10">
  152. +   </skin>
  153. +  
  154. +   <skin id="10" name="Dark Knight Suit" utx_name="knight" chest="10112" legs="0" gloves="0" feet="0" hair="10113" isVip="0"  price_id="3470" price="10">
  155. +   </skin>
  156. +  
  157. +   <skin id="11" name="Light Assassin Suit" utx_name="light" chest="10120" legs="0" gloves="0" feet="0" hair="10121" isVip="0"  price_id="3470" price="10">
  158. +   </skin>
  159. +  
  160. +   <skin id="12" name="Saxon Guard Suit" utx_name="valkyri" chest="10135" legs="0" gloves="0" feet="0" hair="0" isVip="0"  price_id="3470" price="10">
  161. +   </skin>
  162. +  
  163. +   <skin id="13" name="Ninja Suit" utx_name="ninja" chest="10118" legs="0" gloves="0" feet="0" hair="0" isVip="0"  price_id="3470" price="10">
  164. +   </skin>
  165. +  
  166. +   <skin id="14" name="Red Zaken Suit" utx_name="pirate" chest="10136" legs="0" gloves="0" feet="0" hair="10137" isVip="0"  price_id="3470" price="10">
  167. +   </skin>
  168. +  
  169. +   <skin id="15" name="Blue Zaken Suit" utx_name="pirate_blue" chest="10136" legs="0" gloves="0" feet="0" hair="10137" isVip="0"  price_id="3470" price="10">
  170. +   </skin>
  171. +  
  172. +   <skin id="16" name="King Setim Suit" utx_name="rei" chest="10127" legs="0" gloves="0" feet="0" hair="10128" isVip="0"  price_id="3470" price="10">
  173. +   </skin>
  174. +  
  175. +   <skin id="17" name="King White Setim Suit" utx_name="rei2" chest="10133" legs="0" gloves="0" feet="0" hair="10134" isVip="0"  price_id="3470" price="10">
  176. +   </skin>
  177. +  
  178. +   <skin id="18" name="Priest Suit" utx_name="saint" chest="10140" legs="0" gloves="0" feet="0" hair="10141" isVip="0"  price_id="3470" price="10">
  179. +   </skin>
  180. +  
  181. +   <skin id="19" name="Black Samurai Suit" utx_name="samurai" chest="10142" legs="0" gloves="0" feet="0" hair="10143" isVip="0"  price_id="3470" price="10">
  182. +   </skin>
  183. +  
  184. +   <!-- L2 Urban -->
  185. +  
  186. +</list>
  187. \ No newline at end of file
  188. diff --git a/src/Base/SkinBeauty/Skin.java b/src/Base/SkinBeauty/Skin.java
  189. new file mode 100644
  190. index 0000000..b69a76d
  191. --- /dev/null
  192. +++ b/src/Base/SkinBeauty/Skin.java
  193. @@ -0,0 +1,110 @@
  194. +package Base.SkinBeauty;
  195. +
  196. +import l2jorion.game.datatables.sql.ItemTable;
  197. +import l2jorion.game.templates.L2Item;
  198. +import l2jorion.game.templates.StatsSet;
  199. +
  200. +public class Skin
  201. +{
  202. +   private int id;
  203. +  
  204. +   private StatsSet stats;
  205. +  
  206. +   private boolean released;
  207. +  
  208. +   public Skin(int id, StatsSet stats)
  209. +   {
  210. +       this.id = id;
  211. +       this.stats = stats;
  212. +   }
  213. +  
  214. +   public StatsSet getStats()
  215. +   {
  216. +       return this.stats;
  217. +   }
  218. +  
  219. +   public void setStats(StatsSet stats)
  220. +   {
  221. +       this.stats = stats;
  222. +   }
  223. +  
  224. +   public int getId()
  225. +   {
  226. +       return this.id;
  227. +   }
  228. +  
  229. +   public void setId(int id)
  230. +   {
  231. +       this.id = id;
  232. +   }
  233. +  
  234. +   public boolean isReleased()
  235. +   {
  236. +       return this.released;
  237. +   }
  238. +  
  239. +   public void setReleased(boolean released)
  240. +   {
  241. +       this.released = released;
  242. +   }
  243. +  
  244. +   public int getPrice()
  245. +   {
  246. +       return getStats().getInteger("price");
  247. +   }
  248. +  
  249. +   public int getPriceId()
  250. +   {
  251. +       return getStats().getInteger("price_id");
  252. +   }
  253. +  
  254. +   public String getName()
  255. +   {
  256. +       return getStats().getString("name");
  257. +   }
  258. +  
  259. +   public boolean isVip()
  260. +   {
  261. +       return (getStats().getInteger("isVip") == 1);
  262. +   }
  263. +  
  264. +   public int getHair()
  265. +   {
  266. +       return getStats().getInteger("hair");
  267. +   }
  268. +  
  269. +   public int getChest()
  270. +   {
  271. +       return getStats().getInteger("chest");
  272. +   }
  273. +  
  274. +   public int getGloves()
  275. +   {
  276. +       return getStats().getInteger("gloves");
  277. +   }
  278. +  
  279. +   public int getLegs()
  280. +   {
  281. +       return getStats().getInteger("legs");
  282. +   }
  283. +  
  284. +   public int getFeet()
  285. +   {
  286. +       return getStats().getInteger("feet");
  287. +   }
  288. +  
  289. +   public String getUtxName()
  290. +   {
  291. +       return getStats().getString("utx_name");
  292. +   }
  293. +  
  294. +   public String getPriceItemName()
  295. +   {
  296. +       L2Item i = ItemTable.getInstance().getTemplate(getPriceId());
  297. +       if (i != null)
  298. +       {
  299. +           return i.getName();
  300. +       }
  301. +       return "No Price";
  302. +   }
  303. +}
  304. diff --git a/src/Base/SkinBeauty/SkinData.java b/src/Base/SkinBeauty/SkinData.java
  305. new file mode 100644
  306. index 0000000..2f0fa39
  307. --- /dev/null
  308. +++ b/src/Base/SkinBeauty/SkinData.java
  309. @@ -0,0 +1,253 @@
  310. +package Base.SkinBeauty;
  311. +
  312. +import java.io.File;
  313. +import java.util.ArrayList;
  314. +import java.util.HashMap;
  315. +import java.util.List;
  316. +import java.util.Map;
  317. +
  318. +import org.w3c.dom.Document;
  319. +import org.w3c.dom.NamedNodeMap;
  320. +import org.w3c.dom.Node;
  321. +
  322. +import Base.XML.XMLDocument;
  323. +import l2jorion.game.templates.StatsSet;
  324. +
  325. +public class SkinData extends XMLDocument
  326. +{
  327. +   public static Map<Skin, StatsSet> skinList = new HashMap<>();
  328. +  
  329. +   public SkinData()
  330. +   {
  331. +       load();
  332. +   }
  333. +  
  334. +   public static SkinData getInstance()
  335. +   {
  336. +       return SingleTonHolder._instance;
  337. +   }
  338. +  
  339. +   private static class SingleTonHolder
  340. +   {
  341. +       protected static final SkinData _instance = new SkinData();
  342. +   }
  343. +  
  344. +   @Override
  345. +   protected void load()
  346. +   {
  347. +       loadDocument("./data/xml/Skins.xml");
  348. +   }
  349. +  
  350. +   @Override
  351. +   protected void parseDocument(Document doc, File f)
  352. +   {
  353. +       try
  354. +       {
  355. +           for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
  356. +           {
  357. +               if ("list".equals(n.getNodeName()))
  358. +               {
  359. +                   for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  360. +                   {
  361. +                       if (d.getNodeName().equals("skin"))
  362. +                       {
  363. +                           NamedNodeMap attrs = d.getAttributes();
  364. +                           StatsSet stats = new StatsSet();
  365. +                           Node att = attrs.getNamedItem("id");
  366. +                           if (att == null)
  367. +                           {
  368. +                               LOG.severe("Skin Data: Missing ID for Skin, skipping.");
  369. +                           }
  370. +                           else
  371. +                           {
  372. +                               int id = Integer.parseInt(att.getNodeValue());
  373. +                               stats.set("id", id);
  374. +                               att = attrs.getNamedItem("name");
  375. +                               if (att == null)
  376. +                               {
  377. +                                   LOG.severe("Skin Data: Missing name for skin id: " + stats.getString("id") + ", skipping.");
  378. +                               }
  379. +                               else
  380. +                               {
  381. +                                   stats.set("name", att.getNodeValue());
  382. +                                   att = attrs.getNamedItem("utx_name");
  383. +                                   if (att == null)
  384. +                                   {
  385. +                                       LOG.severe("Skin Data: Missing name for utx_name id: " + stats.getString("id") + ", skipping.");
  386. +                                   }
  387. +                                   else
  388. +                                   {
  389. +                                       stats.set("utx_name", att.getNodeValue());
  390. +                                       att = attrs.getNamedItem("chest");
  391. +                                       if (att == null)
  392. +                                       {
  393. +                                           LOG.severe("Skin Data: Missing chest for skin id: " + stats.getString("id") + ", skipping.");
  394. +                                       }
  395. +                                       else
  396. +                                       {
  397. +                                           stats.set("chest", Integer.parseInt(att.getNodeValue()));
  398. +                                           att = attrs.getNamedItem("gloves");
  399. +                                           if (att == null)
  400. +                                           {
  401. +                                               LOG.severe("Skin Data: Missing gloves for skin id: " + stats.getString("id") + ", skipping.");
  402. +                                           }
  403. +                                           else
  404. +                                           {
  405. +                                               stats.set("gloves", Integer.parseInt(att.getNodeValue()));
  406. +                                               att = attrs.getNamedItem("legs");
  407. +                                               if (att == null)
  408. +                                               {
  409. +                                                   LOG.severe("Skin Data: Missing legs for skin id: " + stats.getString("id") + ", skipping.");
  410. +                                               }
  411. +                                               else
  412. +                                               {
  413. +                                                   stats.set("legs", Integer.parseInt(att.getNodeValue()));
  414. +                                                   att = attrs.getNamedItem("feet");
  415. +                                                   if (att == null)
  416. +                                                   {
  417. +                                                       LOG.severe("Skin Data: Missing gloves for skin id: " + stats.getString("id") + ", skipping.");
  418. +                                                   }
  419. +                                                   else
  420. +                                                   {
  421. +                                                       stats.set("feet", Integer.parseInt(att.getNodeValue()));
  422. +                                                       att = attrs.getNamedItem("hair");
  423. +                                                       if (att == null)
  424. +                                                       {
  425. +                                                           LOG.severe("Skin Data: Missing hair for skin id: " + stats.getString("id") + ", skipping.");
  426. +                                                       }
  427. +                                                       else
  428. +                                                       {
  429. +                                                           stats.set("hair", Integer.parseInt(att.getNodeValue()));
  430. +                                                           att = attrs.getNamedItem("price_id");
  431. +                                                           if (att == null)
  432. +                                                           {
  433. +                                                               LOG.severe("Skin Data: Missing price_id for skin id: " + stats.getString("id") + ", skipping.");
  434. +                                                           }
  435. +                                                           else
  436. +                                                           {
  437. +                                                               stats.set("price_id", Integer.parseInt(att.getNodeValue()));
  438. +                                                               att = attrs.getNamedItem("price");
  439. +                                                               if (att == null)
  440. +                                                               {
  441. +                                                                   LOG.severe("Skin Data: Missing price for skin id: " + stats.getString("id") + ", skipping.");
  442. +                                                               }
  443. +                                                               else
  444. +                                                               {
  445. +                                                                   stats.set("price", Integer.parseInt(att.getNodeValue()));
  446. +                                                                   att = attrs.getNamedItem("isVip");
  447. +                                                                   if (att == null)
  448. +                                                                   {
  449. +                                                                       LOG.severe("Skin Data: Missing price for isVip id: " + stats.getString("id") + ", skipping.");
  450. +                                                                   }
  451. +                                                                   else
  452. +                                                                   {
  453. +                                                                       stats.set("isVip", Integer.parseInt(att.getNodeValue()));
  454. +                                                                       for (Node data = d.getFirstChild(); data != null; data = data.getNextSibling())
  455. +                                                                       {
  456. +                                                                           attrs = data.getAttributes();
  457. +                                                                           if (data.getNodeName().equals("conditions"))
  458. +                                                                           {
  459. +                                                                               for (int i = 0; i < attrs.getLength(); i++)
  460. +                                                                               {
  461. +                                                                                   Node node = attrs.item(i);
  462. +                                                                                   stats.set(node.getNodeName(), node.getNodeValue());
  463. +                                                                               }
  464. +                                                                           }
  465. +                                                                       }
  466. +                                                                       Skin skin = new Skin(id, stats);
  467. +                                                                       skinList.put(skin, stats);
  468. +                                                                   }
  469. +                                                               }
  470. +                                                           }
  471. +                                                       }
  472. +                                                   }
  473. +                                               }
  474. +                                           }
  475. +                                       }
  476. +                                   }
  477. +                               }
  478. +                           }
  479. +                       }
  480. +                   }
  481. +                   System.out.println("SkinData: loaded " + skinList.size() + " skins from XML!");
  482. +               }
  483. +           }
  484. +       }
  485. +       catch (Exception e)
  486. +       {
  487. +           LOG.warning("SkinData: Error while creating table: " + e);
  488. +           e.printStackTrace();
  489. +       }
  490. +   }
  491. +  
  492. +   public Map<Skin, StatsSet> getAllSkins()
  493. +   {
  494. +       return skinList;
  495. +   }
  496. +  
  497. +   public void clear()
  498. +   {
  499. +       skinList.clear();
  500. +       skinList = new HashMap<>();
  501. +   }
  502. +  
  503. +   public void reload()
  504. +   {
  505. +       clear();
  506. +       loadDocument("./data/Skins.xml");
  507. +   }
  508. +  
  509. +   public List<Skin> getSkinList()
  510. +   {
  511. +       List<Skin> skins = new ArrayList<>();
  512. +       for (Map.Entry<Skin, StatsSet> map : skinList.entrySet())
  513. +       {
  514. +           skins.add(map.getKey());
  515. +       }
  516. +       return skins;
  517. +   }
  518. +  
  519. +   public Skin[] getSkinVec()
  520. +   {
  521. +       Skin[] vec = new Skin[getSkinList().size()];
  522. +       for (int i = 0; i < getSkinList().size(); i++)
  523. +       {
  524. +           vec[i] = getSkinList().get(i);
  525. +       }
  526. +       return vec;
  527. +   }
  528. +  
  529. +   public Skin getSkinById(int id)
  530. +   {
  531. +       for (Map.Entry<Skin, StatsSet> map : skinList.entrySet())
  532. +       {
  533. +           if (map.getKey().getId() == id)
  534. +           {
  535. +               return map.getKey();
  536. +           }
  537. +       }
  538. +       return null;
  539. +   }
  540. +  
  541. +   public Map<Integer, List<Skin>> getSkinPages()
  542. +   {
  543. +       Map<Integer, List<Skin>> skinPages = new HashMap<>();
  544. +       int page = 0;
  545. +       int counter = 0;
  546. +       for (Skin skin : getInstance().getSkinList())
  547. +       {
  548. +           if (counter >= 10)
  549. +           {
  550. +               page++;
  551. +               counter = 0;
  552. +           }
  553. +           if (skinPages.get(Integer.valueOf(page)) == null)
  554. +           {
  555. +               skinPages.put(Integer.valueOf(page), new ArrayList<>());
  556. +           }
  557. +           skinPages.get(Integer.valueOf(page)).add(skin);
  558. +           counter++;
  559. +       }
  560. +       return skinPages;
  561. +   }
  562. +}
  563. diff --git a/src/Base/Util/Mysql.java b/src/Base/Util/Mysql.java
  564. new file mode 100644
  565. index 0000000..31aba5f
  566. --- /dev/null
  567. +++ b/src/Base/Util/Mysql.java
  568. @@ -0,0 +1,198 @@
  569. +package Base.Util;
  570. +
  571. +import java.sql.Connection;
  572. +import java.sql.PreparedStatement;
  573. +import java.sql.ResultSet;
  574. +import java.sql.SQLException;
  575. +import java.sql.Statement;
  576. +import java.util.logging.Logger;
  577. +
  578. +import l2jorion.util.database.L2DatabaseFactory;
  579. +
  580. +public abstract class Mysql
  581. +{
  582. +   public static final Logger _log = Logger.getLogger(Mysql.class.getName());
  583. +  
  584. +   /**
  585. +    * Performs a simple sql queries where unnecessary control parameters <BR>
  586. +    * NOTE: In this method, the parameters passed are not valid for SQL-injection!
  587. +    * @param db
  588. +    * @param query
  589. +    * @param vars
  590. +    * @return
  591. +    */
  592. +   public static boolean setEx(L2DatabaseFactory db, String query, Object... vars)
  593. +   {
  594. +       Connection con = null;
  595. +       Statement statement = null;
  596. +       PreparedStatement pstatement = null;
  597. +       boolean successed = true;
  598. +      
  599. +       try
  600. +       {
  601. +           if (db == null)
  602. +           {
  603. +               db = L2DatabaseFactory.getInstance();
  604. +           }
  605. +          
  606. +           con = db.getConnection();
  607. +           if (vars.length == 0)
  608. +           {
  609. +               statement = con.createStatement();
  610. +               statement.executeUpdate(query);
  611. +               statement.close();
  612. +           }
  613. +           else
  614. +           {
  615. +               pstatement = con.prepareStatement(query);
  616. +               setVars(pstatement, vars);
  617. +               pstatement.executeUpdate();
  618. +               pstatement.close();
  619. +           }
  620. +           con.close();
  621. +       }
  622. +       catch (Exception e)
  623. +       {
  624. +           _log.warning("Could not execute update '" + query + "': " + e);
  625. +           e.printStackTrace();
  626. +           successed = false;
  627. +       }
  628. +       finally
  629. +       {
  630. +           closeQuietly(con, pstatement);
  631. +           closeQuietly(statement);
  632. +       }
  633. +       return successed;
  634. +   }
  635. +  
  636. +   public static void setVars(PreparedStatement statement, Object... vars) throws SQLException
  637. +   {
  638. +       Number n;
  639. +       long long_val;
  640. +       double double_val;
  641. +       for (int i = 0; i < vars.length; i++)
  642. +       {
  643. +           if (vars[i] instanceof Number)
  644. +           {
  645. +               n = (Number) vars[i];
  646. +               long_val = n.longValue();
  647. +               double_val = n.doubleValue();
  648. +               if (long_val == double_val)
  649. +               {
  650. +                   statement.setLong(i + 1, long_val);
  651. +               }
  652. +               else
  653. +               {
  654. +                   statement.setDouble(i + 1, double_val);
  655. +               }
  656. +           }
  657. +           else if (vars[i] instanceof String)
  658. +           {
  659. +               statement.setString(i + 1, (String) vars[i]);
  660. +           }
  661. +       }
  662. +   }
  663. +  
  664. +   public static boolean set(String query, Object... vars)
  665. +   {
  666. +       return setEx(null, query, vars);
  667. +   }
  668. +  
  669. +   public static boolean set(String query)
  670. +   {
  671. +       return setEx(null, query);
  672. +   }
  673. +  
  674. +   public static void closeQuietly(Connection conn)
  675. +   {
  676. +       try
  677. +       {
  678. +           close(conn);
  679. +       }
  680. +       catch (SQLException e)
  681. +       { // NOPMD
  682. +           // quiet
  683. +       }
  684. +   }
  685. +  
  686. +   public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs)
  687. +   {
  688. +      
  689. +       try
  690. +       {
  691. +           closeQuietly(rs);
  692. +       }
  693. +       finally
  694. +       {
  695. +           try
  696. +           {
  697. +               closeQuietly(stmt);
  698. +           }
  699. +           finally
  700. +           {
  701. +               closeQuietly(conn);
  702. +           }
  703. +       }
  704. +   }
  705. +  
  706. +   public static void closeQuietly(Connection conn, Statement stmt)
  707. +   {
  708. +       try
  709. +       {
  710. +           closeQuietly(stmt);
  711. +       }
  712. +       finally
  713. +       {
  714. +           closeQuietly(conn);
  715. +       }
  716. +   }
  717. +  
  718. +   public static void closeQuietly(ResultSet rs)
  719. +   {
  720. +       try
  721. +       {
  722. +           close(rs);
  723. +       }
  724. +       catch (SQLException e)
  725. +       { // NOPMD
  726. +           // quiet
  727. +       }
  728. +   }
  729. +  
  730. +   public static void closeQuietly(Statement stmt)
  731. +   {
  732. +       try
  733. +       {
  734. +           close(stmt);
  735. +       }
  736. +       catch (SQLException e)
  737. +       { // NOPMD
  738. +           // quiet
  739. +       }
  740. +   }
  741. +  
  742. +   public static void close(Connection conn) throws SQLException
  743. +   {
  744. +       if (conn != null)
  745. +       {
  746. +           conn.close();
  747. +       }
  748. +   }
  749. +  
  750. +   public static void close(ResultSet rs) throws SQLException
  751. +   {
  752. +       if (rs != null)
  753. +       {
  754. +           rs.close();
  755. +       }
  756. +   }
  757. +  
  758. +   public static void close(Statement stmt) throws SQLException
  759. +   {
  760. +       if (stmt != null)
  761. +       {
  762. +           stmt.close();
  763. +       }
  764. +   }
  765. +  
  766. +}
  767. \ No newline at end of file
  768. diff --git a/src/Base/XML/XMLDocument.java b/src/Base/XML/XMLDocument.java
  769. new file mode 100644
  770. index 0000000..2e9bb7a
  771. --- /dev/null
  772. +++ b/src/Base/XML/XMLDocument.java
  773. @@ -0,0 +1,137 @@
  774. +package Base.XML;
  775. +
  776. +import java.io.File;
  777. +import java.util.function.Consumer;
  778. +import java.util.function.Predicate;
  779. +import java.util.logging.Level;
  780. +import java.util.logging.Logger;
  781. +
  782. +import javax.xml.parsers.DocumentBuilderFactory;
  783. +
  784. +import org.w3c.dom.Document;
  785. +import org.w3c.dom.NamedNodeMap;
  786. +import org.w3c.dom.Node;
  787. +import org.w3c.dom.NodeList;
  788. +
  789. +import l2jorion.game.templates.StatsSet;
  790. +
  791. +/**
  792. + * An XML document, relying on a static and single DocumentBuilderFactory.
  793. + */
  794. +public abstract class XMLDocument
  795. +{
  796. +   protected static final Logger LOG = Logger.getLogger(XMLDocument.class.getName());
  797. +  
  798. +   private static final DocumentBuilderFactory BUILDER;
  799. +   static
  800. +   {
  801. +       BUILDER = DocumentBuilderFactory.newInstance();
  802. +       BUILDER.setValidating(false);
  803. +       BUILDER.setIgnoringComments(true);
  804. +   }
  805. +  
  806. +   abstract protected void load();
  807. +  
  808. +   abstract protected void parseDocument(Document doc, File f);
  809. +  
  810. +   public void loadDocument(String filePath)
  811. +   {
  812. +       loadDocument(new File(filePath));
  813. +   }
  814. +  
  815. +   /**
  816. +    * Parse an entire directory or file if found.
  817. +    * @param file
  818. +    */
  819. +   public void loadDocument(File file)
  820. +   {
  821. +       if (!file.exists())
  822. +       {
  823. +           LOG.severe("The following file or directory doesn't exist: " + file.getName());
  824. +           return;
  825. +       }
  826. +      
  827. +       if (file.isDirectory())
  828. +       {
  829. +           for (File f : file.listFiles())
  830. +           {
  831. +               loadDocument(f);
  832. +           }
  833. +       }
  834. +       else if (file.isFile())
  835. +       {
  836. +           try
  837. +           {
  838. +               parseDocument(BUILDER.newDocumentBuilder().parse(file), file);
  839. +           }
  840. +           catch (Exception e)
  841. +           {
  842. +               LOG.log(Level.SEVERE, "Error loading XML file " + file.getName(), e);
  843. +           }
  844. +       }
  845. +   }
  846. +  
  847. +   public void forEach(Node node, Consumer<Node> action)
  848. +   {
  849. +       forEach(node, a -> true, action);
  850. +   }
  851. +  
  852. +   public void forEach(Node node, String nodeName, Consumer<Node> action)
  853. +   {
  854. +       forEach(node, innerNode ->
  855. +       {
  856. +           if (nodeName.contains("|"))
  857. +           {
  858. +               final String[] nodeNames = nodeName.split("\\|");
  859. +               for (String name : nodeNames)
  860. +               {
  861. +                   if (!name.isEmpty() && name.equals(innerNode.getNodeName()))
  862. +                   {
  863. +                       return true;
  864. +                   }
  865. +               }
  866. +               return false;
  867. +           }
  868. +           return nodeName.equals(innerNode.getNodeName());
  869. +       }, action);
  870. +   }
  871. +  
  872. +   public void forEach(Node node, Predicate<Node> filter, Consumer<Node> action)
  873. +   {
  874. +       final NodeList list = node.getChildNodes();
  875. +       for (int i = 0; i < list.getLength(); i++)
  876. +       {
  877. +           final Node targetNode = list.item(i);
  878. +           if (filter.test(targetNode))
  879. +           {
  880. +               action.accept(targetNode);
  881. +           }
  882. +       }
  883. +   }
  884. +  
  885. +   public StatsSet parseAttributes(Node node)
  886. +   {
  887. +       final NamedNodeMap attrs = node.getAttributes();
  888. +       final StatsSet map = new StatsSet();
  889. +       for (int i = 0; i < attrs.getLength(); i++)
  890. +       {
  891. +           final Node att = attrs.item(i);
  892. +           map.set(att.getNodeName(), att.getNodeValue());
  893. +       }
  894. +       return map;
  895. +   }
  896. +  
  897. +   /**
  898. +    * This method parses the content of a NamedNodeMap and feed the given StatsSet.
  899. +    * @param attrs : The NamedNodeMap to parse.
  900. +    * @param set : The StatsSet to feed.
  901. +    */
  902. +   public static void parseAndFeed(NamedNodeMap attrs, StatsSet set)
  903. +   {
  904. +       for (int i = 0; i < attrs.getLength(); i++)
  905. +       {
  906. +           final Node attr = attrs.item(i);
  907. +           set.set(attr.getNodeName(), attr.getNodeValue());
  908. +       }
  909. +   }
  910. +}
  911. \ No newline at end of file
  912. diff --git a/src/l2jorion/Config.java b/src/l2jorion/Config.java
  913. index bbf70a0..a713d3e 100644
  914. --- a/src/l2jorion/Config.java
  915. +++ b/src/l2jorion/Config.java
  916. @@ -2358,6 +2358,10 @@
  917.     public static String PM_TEXT2;
  918.     public static boolean NEW_PLAYER_EFFECT;
  919.    
  920. +   public static String TEXTURE_SKIN_PACKAGE;
  921. +  
  922. +   public static String ACQUIRED_SKIN_SUFFIX;
  923. +  
  924.     public static void loadL2jOrionConfig()
  925.     {
  926.         final String L2jOrion = ConfigLoader.L2jOrion_CONFIG_FILE;
  927. @@ -2381,6 +2385,9 @@
  928.                 LIST_FAKE_ARMOR_ITEMS.add(Integer.parseInt(id));
  929.             }
  930.            
  931. +           TEXTURE_SKIN_PACKAGE = L2jOrionSettings.getProperty("TextureSkinPackageName", "MAYKE_MENDES_SKIN");
  932. +           ACQUIRED_SKIN_SUFFIX = L2jOrionSettings.getProperty("TextureSkinSuffixName", "_f");
  933. +          
  934.             FREE_TELEPORT_UNTIL = Integer.parseInt(L2jOrionSettings.getProperty("FreeTeleportUntil", "1"));
  935.             REMOVAL_AUGMENTATION_FREE = Boolean.parseBoolean(L2jOrionSettings.getProperty("RemovalAugmentationFree", "False"));
  936.             ALLOW_FREIGHT_AUGMENTED = Boolean.parseBoolean(L2jOrionSettings.getProperty("AllowFreightAugmentedItem", "False"));
  937. diff --git a/src/l2jorion/game/GameServer.java b/src/l2jorion/game/GameServer.java
  938. index 214bbfe..99c3a68 100644
  939. --- a/src/l2jorion/game/GameServer.java
  940. +++ b/src/l2jorion/game/GameServer.java
  941. @@ -30,6 +30,7 @@
  942. import java.util.Date;
  943. import java.util.logging.LogManager;
  944.  
  945. +import Base.SkinBeauty.SkinData;
  946. import hwid.hwid;
  947. import l2jorion.Config;
  948. import l2jorion.ConfigLoader;
  949. @@ -467,6 +468,9 @@
  950.         Util.printSection("Scripts");
  951.         QuestManager.getInstance();
  952.        
  953. +       Util.printSection("Skin Manager");
  954. +       SkinData.getInstance();
  955. +      
  956.         // Donate Items
  957.         TaskItemDonate.getInstance();
  958.        
  959. diff --git a/src/l2jorion/game/handler/ItemHandler.java b/src/l2jorion/game/handler/ItemHandler.java
  960. index 041c584..eedc4e4 100644
  961. --- a/src/l2jorion/game/handler/ItemHandler.java
  962. +++ b/src/l2jorion/game/handler/ItemHandler.java
  963. @@ -65,6 +65,7 @@
  964. import l2jorion.game.handler.item.Scrolls;
  965. import l2jorion.game.handler.item.Seed;
  966. import l2jorion.game.handler.item.SevenSignsRecord;
  967. +import l2jorion.game.handler.item.Skins;
  968. import l2jorion.game.handler.item.SoulCrystals;
  969. import l2jorion.game.handler.item.SoulShots;
  970. import l2jorion.game.handler.item.SpecialXMas;
  971. @@ -134,6 +135,7 @@
  972.         registerItemHandler(new ChristmasTree());
  973.         registerItemHandler(new Crystals());
  974.         registerItemHandler(new HsItems());
  975. +       registerItemHandler(new Skins());
  976.        
  977.         LOG.info("ItemHandler: Loaded " + _datatable.size() + " handlers");
  978.     }
  979. diff --git a/src/l2jorion/game/handler/item/Skins.java b/src/l2jorion/game/handler/item/Skins.java
  980. new file mode 100644
  981. index 0000000..187d84e
  982. --- /dev/null
  983. +++ b/src/l2jorion/game/handler/item/Skins.java
  984. @@ -0,0 +1,222 @@
  985. +package l2jorion.game.handler.item;
  986. +
  987. +import Base.SkinBeauty.Skin;
  988. +import Base.SkinBeauty.SkinData;
  989. +
  990. +import l2jorion.game.handler.IItemHandler;
  991. +
  992. +import l2jorion.game.model.actor.instance.L2ItemInstance;
  993. +import l2jorion.game.model.actor.instance.L2PcInstance;
  994. +import l2jorion.game.model.actor.instance.L2PlayableInstance;
  995. +import l2jorion.game.network.serverpackets.MagicSkillUser;
  996. +import l2jorion.game.thread.ThreadPoolManager;
  997. +
  998. +/**
  999. + * @author Williams and Stinkymadness
  1000. + */
  1001. +public class Skins implements IItemHandler
  1002. +{
  1003. +   private static final int ITEM_IDS[] =
  1004. +   {
  1005. +       19000,
  1006. +       19001,
  1007. +       19002,
  1008. +       19003,
  1009. +       19004,
  1010. +       19005,
  1011. +       19006,
  1012. +       19007,
  1013. +       19008,
  1014. +       19009,
  1015. +       19010,
  1016. +       19011,
  1017. +       19012,
  1018. +       19013,
  1019. +       19014,
  1020. +       19015,
  1021. +       19016,
  1022. +       19017,
  1023. +       19018,
  1024. +       19019,
  1025. +       19020,
  1026. +       19021,
  1027. +       19022,
  1028. +       19023,
  1029. +       19024,
  1030. +       19025,
  1031. +       19026,
  1032. +       19027,
  1033. +       19028,
  1034. +       19029,
  1035. +       19030,
  1036. +       19031,
  1037. +       19033,
  1038. +       19034,
  1039. +       19035,
  1040. +       19036,
  1041. +       19037,
  1042. +       19038,
  1043. +       19039,
  1044. +       19040,
  1045. +       19041,
  1046. +       19042,
  1047. +       19043,
  1048. +       19044,
  1049. +       19045,
  1050. +       19046,
  1051. +       19047,
  1052. +       19048,
  1053. +       19049,
  1054. +       19050,
  1055. +       19051,
  1056. +       19052,
  1057. +       19053,
  1058. +       19054,
  1059. +       19055,
  1060. +       19056,
  1061. +       19057,
  1062. +       19058,
  1063. +       19059,
  1064. +       19060,
  1065. +       19061,
  1066. +       19062,
  1067. +       19063,
  1068. +       19064,
  1069. +       19065,
  1070. +       19066,
  1071. +       19067,
  1072. +       19068,
  1073. +       19069,
  1074. +       19070,
  1075. +       19071,
  1076. +       19072,
  1077. +       19073,
  1078. +       19074,
  1079. +       19075,
  1080. +       19076,
  1081. +       19077,
  1082. +       19078,
  1083. +       19079,
  1084. +       19080,
  1085. +       19081,
  1086. +       19082,
  1087. +       19083,
  1088. +       19084,
  1089. +       19085,
  1090. +       19086,
  1091. +       19087,
  1092. +       19088,
  1093. +       19089,
  1094. +       19090,
  1095. +       19091,
  1096. +       19092,
  1097. +       19093,
  1098. +       19094,
  1099. +       19095,
  1100. +       19096,
  1101. +       19097,
  1102. +       19098,
  1103. +       19099,
  1104. +       19100,
  1105. +       19101,
  1106. +       19102,
  1107. +       19103,
  1108. +       19104,
  1109. +       19105,
  1110. +       19106,
  1111. +       19107,
  1112. +       19108,
  1113. +       19109,
  1114. +       19110,
  1115. +       19111,
  1116. +       19112,
  1117. +       19113,
  1118. +       19114,
  1119. +       19115,
  1120. +       19116,
  1121. +       19117,
  1122. +       19118,
  1123. +       19119,
  1124. +       19120,
  1125. +       19121,
  1126. +       19122,
  1127. +       19123,
  1128. +       19124,
  1129. +       19125,
  1130. +       19126,
  1131. +       19127,
  1132. +       19128,
  1133. +       19129,
  1134. +       19130,
  1135. +       19131,
  1136. +       19132,
  1137. +       19133,
  1138. +       19134,
  1139. +       19135,
  1140. +       19136,
  1141. +       19137,
  1142. +       19138,
  1143. +       19139,
  1144. +       19140,
  1145. +       19141,
  1146. +       15020,
  1147. +       29142
  1148. +  
  1149. +   };
  1150. +  
  1151. +   public static void VisualTeste(L2PcInstance player)
  1152. +   {
  1153. +       Skin free = SkinData.getInstance().getSkinById(0);
  1154. +       player.setActiveSkin(free);
  1155. +       player.broadcastUserInfo();
  1156. +   }
  1157. +  
  1158. +   @Override
  1159. +   public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  1160. +   {
  1161. +       final L2PcInstance player = (L2PcInstance) playable;
  1162. +      
  1163. +       ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  1164. +       {
  1165. +           @Override
  1166. +           public void run()
  1167. +           {
  1168. +               playable.setIsImmobileUntilAttacked(false);
  1169. +           }
  1170. +       }, 1100);
  1171. +      
  1172. +       if (!(playable instanceof L2PcInstance))
  1173. +       {
  1174. +           return;
  1175. +       }
  1176. +      
  1177. +       final Skin dress = SkinData.getInstance().getSkinById(item.getItemId());
  1178. +      
  1179. +       if (dress == null)
  1180. +       {
  1181. +           return;
  1182. +       }
  1183. +      
  1184. +       if (!player.isDressMeEnabled())
  1185. +       {
  1186. +           player.setActiveSkin(dress);
  1187. +           playable.setIsImmobileUntilAttacked(true);
  1188. +           player.broadcastPacket(new MagicSkillUser(player, player, 1047, 1, 1100, 0));
  1189. +           player.broadcastUserInfo();
  1190. +       }
  1191. +       else
  1192. +       {
  1193. +           player.setActiveSkin(dress);
  1194. +           playable.setIsImmobileUntilAttacked(true);
  1195. +           player.broadcastPacket(new MagicSkillUser(player, player, 1047, 1, 1100, 0));
  1196. +           player.broadcastUserInfo();
  1197. +       }
  1198. +      
  1199. +   }
  1200. +  
  1201. +   @Override
  1202. +   public int[] getItemIds()
  1203. +   {
  1204. +       return ITEM_IDS;
  1205. +   }
  1206. +}
  1207. \ No newline at end of file
  1208. diff --git a/src/l2jorion/game/model/actor/instance/L2BeautyShopInstance.java b/src/l2jorion/game/model/actor/instance/L2BeautyShopInstance.java
  1209. new file mode 100644
  1210. index 0000000..867e34d
  1211. --- /dev/null
  1212. +++ b/src/l2jorion/game/model/actor/instance/L2BeautyShopInstance.java
  1213. @@ -0,0 +1,251 @@
  1214. +package l2jorion.game.model.actor.instance;
  1215. +
  1216. +import java.util.List;
  1217. +import java.util.concurrent.ScheduledFuture;
  1218. +
  1219. +import Base.SkinBeauty.Skin;
  1220. +import Base.SkinBeauty.SkinData;
  1221. +import l2jorion.Config;
  1222. +import l2jorion.game.ai.CtrlIntention;
  1223. +import l2jorion.game.model.PcInventory;
  1224. +import l2jorion.game.network.serverpackets.ActionFailed;
  1225. +import l2jorion.game.network.serverpackets.MoveToPawn;
  1226. +import l2jorion.game.network.serverpackets.MyTargetSelected;
  1227. +import l2jorion.game.network.serverpackets.NpcHtmlMessage;
  1228. +import l2jorion.game.network.serverpackets.ValidateLocation;
  1229. +import l2jorion.game.templates.L2NpcTemplate;
  1230. +
  1231. +public class L2BeautyShopInstance extends L2NpcInstance
  1232. +{
  1233. +   ScheduledFuture<?> task;
  1234. +  
  1235. +   public L2BeautyShopInstance(int objectId, L2NpcTemplate template)
  1236. +   {
  1237. +       super(objectId, template);
  1238. +   }
  1239. +  
  1240. +   @Override
  1241. +   public void onAction(L2PcInstance player)
  1242. +   {
  1243. +       if (this != player.getTarget())
  1244. +       {
  1245. +           player.setTarget(this);
  1246. +           player.sendPacket(new MyTargetSelected(getObjectId(), 0));
  1247. +           player.sendPacket(new ValidateLocation(this));
  1248. +       }
  1249. +       else if (!canInteract(player))
  1250. +       {
  1251. +           player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
  1252. +       }
  1253. +       else
  1254. +       {
  1255. +           player.sendPacket(new MoveToPawn(player, this, 150));
  1256. +           if (hasRandomAnimation())
  1257. +           {
  1258. +               onRandomAnimation();
  1259. +           }
  1260. +           showMainWindow(player, 0);
  1261. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  1262. +       }
  1263. +   }
  1264. +  
  1265. +   public static String getIconPath(L2PcInstance player, Skin skin)
  1266. +   {
  1267. +       if (player.containsSkin(skin))
  1268. +       {
  1269. +           return skin.getUtxName();
  1270. +       }
  1271. +       return skin.getUtxName() + Config.ACQUIRED_SKIN_SUFFIX;
  1272. +   }
  1273. +  
  1274. +   public static String showButtons(L2PcInstance player, Skin skin)
  1275. +   {
  1276. +       StringBuilder sb = new StringBuilder();
  1277. +       if (!player.getSkins().contains(skin))
  1278. +       {
  1279. +           sb.append("<tr>");
  1280. +           sb.append("<td align=center><button value=\"Buy\" action=\"bypass -h acquireSkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1281. +           sb.append("<td align=center><button value=\"Try\" action=\"bypass -h trySkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1282. +           sb.append("</tr>");
  1283. +           sb.append("<tr>");
  1284. +           sb.append("<td align=center><button value=\"Equip\" action=\"bypass -h equipSkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1285. +           sb.append("<td align=center><button value=\"Unequip\" action=\"bypass -h unequipSkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1286. +           sb.append("</tr>");
  1287. +       }
  1288. +       else
  1289. +       {
  1290. +           sb.append("<tr>");
  1291. +           sb.append("<td align=center><button value=\"Equip\" action=\"bypass -h equipSkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1292. +           sb.append("<td align=center><button value=\"Unequip\" action=\"bypass -h unequipSkin " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>");
  1293. +           sb.append("</tr>");
  1294. +       }
  1295. +       return sb.toString();
  1296. +   }
  1297. +  
  1298. +   public static String generatePagesHtml(L2PcInstance player)
  1299. +   {
  1300. +       StringBuilder sb = new StringBuilder();
  1301. +       for (Integer i : SkinData.getInstance().getSkinPages().keySet())
  1302. +       {
  1303. +           sb.append("<td>");
  1304. +           sb.append("<table width=21 align=left >");
  1305. +           sb.append("<tr>");
  1306. +           sb.append("<td width=21 align=left><button value=\"Page " + i + "\" action=\"bypass -h skinPage " + i + "\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
  1307. +           sb.append("</tr>");
  1308. +           sb.append("</table>");
  1309. +           sb.append("</td>");
  1310. +       }
  1311. +       return sb.toString();
  1312. +   }
  1313. +  
  1314. +   public static String generateSkinsHtml(L2PcInstance player, int page)
  1315. +   {
  1316. +       StringBuilder sb = new StringBuilder();
  1317. +       int i = 0;
  1318. +       List<Skin> list = SkinData.getInstance().getSkinPages().get(Integer.valueOf(page));
  1319. +       for (Skin skin : list)
  1320. +       {
  1321. +           sb.append("<tr>");
  1322. +           sb.append("<td>");
  1323. +           sb.append("<img src=\"L2UI.SquareGray\" width=295 height=1>");
  1324. +           if (i % 2 == 0)
  1325. +           {
  1326. +               sb.append("<table align=center  height=40 bgcolor=000000>");
  1327. +           }
  1328. +           else
  1329. +           {
  1330. +               sb.append("<table align=center  height=40");
  1331. +           }
  1332. +           sb.append("<tr>");
  1333. +           sb.append("<td width=40>");
  1334. +           sb.append("<img src=\"" + Config.TEXTURE_SKIN_PACKAGE + "." + getIconPath(player, skin) + "\" width=32 height=32/>");
  1335. +           sb.append("</td>");
  1336. +           sb.append("<td width=180>");
  1337. +           sb.append("<font color=LEVEL>" + getSkinName(skin) + "</font><br1>Price:" + skin.getPrice() + " " + skin.getPriceItemName());
  1338. +           if (player.getSkins().contains(skin))
  1339. +           {
  1340. +               sb.append("<font color=ff0000>(Acquired)</font>");
  1341. +           }
  1342. +           sb.append("</td>");
  1343. +           sb.append("<td align=center width=100 valign=center>");
  1344. +           sb.append("<button value=\"Open \" action=\"bypass -h skinhtm " + skin.getId() + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">");
  1345. +           sb.append("</td>");
  1346. +           sb.append("</tr>");
  1347. +           sb.append("</table>");
  1348. +           sb.append("</td>");
  1349. +           sb.append("</tr>");
  1350. +           i++;
  1351. +       }
  1352. +       return sb.toString();
  1353. +   }
  1354. +  
  1355. +   public static String getSkinName(Skin skin)
  1356. +   {
  1357. +       if (skin.isVip())
  1358. +       {
  1359. +           return skin.getName() + "<font color=\"ff0000\"> (VIP)</font>";
  1360. +       }
  1361. +       return skin.getName();
  1362. +   }
  1363. +  
  1364. +   public void showMainWindow(L2PcInstance player, int page)
  1365. +   {
  1366. +       String filename = "data/html/SkinManager/Main.htm";
  1367. +       NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  1368. +       html.setFile(filename);
  1369. +       html.replace("%objectId%", String.valueOf(getObjectId()));
  1370. +       html.replace("%npcId%", String.valueOf(getNpcId()));
  1371. +       html.replace("%npcname%", getName());
  1372. +       html.replace("%hat%", player.isActiveHat() ? "ON" : "OFF");
  1373. +       html.replace("%skins%", generateSkinsHtml(player, page));
  1374. +       html.replace("%pages%", generatePagesHtml(player));
  1375. +       player.sendPacket(html);
  1376. +       filename = null;
  1377. +       html = null;
  1378. +   }
  1379. +  
  1380. +   @Override
  1381. +   public void onBypassFeedback(L2PcInstance activeChar, String _command)
  1382. +   {
  1383. +   }
  1384. +  
  1385. +   public static boolean reduceItem(L2PcInstance player, int itemId, int itemPrice)
  1386. +   {
  1387. +       PcInventory inv = player.getInventory();
  1388. +       try
  1389. +       {
  1390. +           if (inv.getItemByItemId(itemId) == null)
  1391. +           {
  1392. +               player.sendMessage("You don't have required items!");
  1393. +               return false;
  1394. +           }
  1395. +           if (inv.getItemByItemId(itemId).getCount() < itemPrice)
  1396. +           {
  1397. +               player.sendMessage("You don't have required items!");
  1398. +               return false;
  1399. +           }
  1400. +           player.destroyItemByItemId("skin buy", itemId, itemPrice, player, true);
  1401. +           return true;
  1402. +       }
  1403. +       catch (Exception e)
  1404. +       {
  1405. +           e.printStackTrace();
  1406. +           return false;
  1407. +       }
  1408. +   }
  1409. +  
  1410. +   public static boolean equipSkin(L2PcInstance activeChar, int id, boolean trying)
  1411. +   {
  1412. +       Skin skin = SkinData.getInstance().getSkinById(id);
  1413. +      
  1414. +       if (activeChar.getSkinId() == 0)
  1415. +       {
  1416. +           Skin dress = SkinData.getInstance().getSkinById(id);
  1417. +           activeChar.setActiveSkin(dress);
  1418. +          
  1419. +       }
  1420. +       if (trying)
  1421. +       {
  1422. +           Skin dress = SkinData.getInstance().getSkinById(id);
  1423. +           activeChar.setActiveSkin(dress);
  1424. +           activeChar.setActiveHat(true);
  1425. +           activeChar.setDressMeEnabled(true);
  1426. +           activeChar.broadcastUserInfo();
  1427. +           activeChar.setSkinId(skin.getId());
  1428. +           return true;
  1429. +       }
  1430. +       if (activeChar.isDressMeEnabled() && !trying)
  1431. +       {
  1432. +           activeChar.sendMessage("First unequip your actual skin!");
  1433. +           return false;
  1434. +       }
  1435. +       if (activeChar.getSkins().contains(skin))
  1436. +       {
  1437. +           Skin dress = SkinData.getInstance().getSkinById(id);
  1438. +           activeChar.setActiveSkin(dress);
  1439. +           activeChar.setActiveHat(true);
  1440. +           activeChar.setDressMeEnabled(true);
  1441. +           activeChar.broadcastUserInfo();
  1442. +           activeChar.setSkinId(skin.getId());
  1443. +           activeChar.sendMessage("Skin " + skin.getStats().getString("name") + " equiped!");
  1444. +           return true;
  1445. +       }
  1446. +       activeChar.sendMessage("You don't own this skin!");
  1447. +       return false;
  1448. +   }
  1449. +  
  1450. +   @Override
  1451. +   public String getHtmlPath(L2PcInstance player, int npcId, int val)
  1452. +   {
  1453. +       String pom = "";
  1454. +       if (val == 0)
  1455. +       {
  1456. +           pom = "" + npcId;
  1457. +       }
  1458. +       else
  1459. +       {
  1460. +           pom = npcId + "-" + val;
  1461. +       }
  1462. +       return "data/html/SkinManager/" + pom + ".htm";
  1463. +   }
  1464. +}
  1465. diff --git a/src/l2jorion/game/model/actor/instance/L2PcInstance.java b/src/l2jorion/game/model/actor/instance/L2PcInstance.java
  1466. index 8d9b411..eb7f14f 100644
  1467. --- a/src/l2jorion/game/model/actor/instance/L2PcInstance.java
  1468. +++ b/src/l2jorion/game/model/actor/instance/L2PcInstance.java
  1469. @@ -40,6 +40,9 @@
  1470.  import java.util.concurrent.TimeUnit;
  1471.  import java.util.concurrent.locks.ReentrantLock;
  1472.  
  1473. +import Base.SkinBeauty.Skin;
  1474. +import Base.SkinBeauty.SkinData;
  1475. +import Base.Util.Mysql;
  1476.  import javolution.text.TextBuilder;
  1477.  import javolution.util.FastList;
  1478.  import javolution.util.FastMap;
  1479. @@ -10027,7 +10030,7 @@
  1480.                 }
  1481.                
  1482.                 CursedWeaponsManager.getInstance().checkPlayer(player);
  1483. -              
  1484. +               player.loadSkins();
  1485.                 player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));
  1486.                
  1487.                 player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
  1488. @@ -10314,6 +10317,8 @@
  1489.         storeCharBase();
  1490.         storeCharSub();
  1491.        
  1492. +       saveSkins();
  1493. +      
  1494.         // Dont store effect if the char was on Offline trade
  1495.         if (!isStored())
  1496.         {
  1497. @@ -21169,6 +21174,134 @@
  1498.         _dressed = val;
  1499.     }
  1500.    
  1501. +   public ScheduledFuture<?> visualTask;
  1502. +  
  1503. +   public int visualizationTime;
  1504. +  
  1505. +   private Skin activeSkin;
  1506. +  
  1507. +   private boolean isActiveHat;
  1508. +  
  1509. +   private List<Skin> skins;
  1510. +  
  1511. +   private int skinId;
  1512. +  
  1513. +   public Skin getActiveSkin()
  1514. +   {
  1515. +       return this.activeSkin;
  1516. +   }
  1517. +  
  1518. +   public void setActiveSkin(Skin activeSkin)
  1519. +   {
  1520. +       this.activeSkin = activeSkin;
  1521. +   }
  1522. +  
  1523. +   public int getSkinId()
  1524. +   {
  1525. +       return this.skinId;
  1526. +   }
  1527. +  
  1528. +   public void setSkinId(int skinId)
  1529. +   {
  1530. +       this.skinId = skinId;
  1531. +   }
  1532. +  
  1533. +   public boolean isActiveHat()
  1534. +   {
  1535. +       return this.isActiveHat;
  1536. +   }
  1537. +  
  1538. +   public void setActiveHat(boolean isActiveHat)
  1539. +   {
  1540. +       this.isActiveHat = isActiveHat;
  1541. +   }
  1542. +  
  1543. +   public List<Skin> getSkins()
  1544. +   {
  1545. +       return this.skins;
  1546. +   }
  1547. +  
  1548. +   public void setSkins(List<Skin> skins)
  1549. +   {
  1550. +       this.skins = skins;
  1551. +   }
  1552. +  
  1553. +   public boolean containsSkin(Skin skin)
  1554. +   {
  1555. +       return getSkins().contains(skin);
  1556. +   }
  1557. +  
  1558. +   public boolean loadSkins()
  1559. +   {
  1560. +       if (this.skins == null)
  1561. +       {
  1562. +           this.skins = new ArrayList<>();
  1563. +       }
  1564. +       Connection con = null;
  1565. +       PreparedStatement offline = null;
  1566. +       ResultSet rs = null;
  1567. +       try
  1568. +       {
  1569. +           con = L2DatabaseFactory.getInstance().getConnection();
  1570. +           PreparedStatement statement = con.prepareStatement("SELECT skin_id FROM player_skins WHERE char_id=?");
  1571. +           statement.setInt(1, getObjectId());
  1572. +           ResultSet rset = statement.executeQuery();
  1573. +           while (rset.next())
  1574. +           {
  1575. +               this.skins.add(SkinData.getInstance().getSkinById(rset.getInt("skin_id")));
  1576. +           }
  1577. +           con.close();
  1578. +           return true;
  1579. +       }
  1580. +       catch (Exception e)
  1581. +       {
  1582. +           e.printStackTrace();
  1583. +           return false;
  1584. +       }
  1585. +       finally
  1586. +       {
  1587. +           Mysql.closeQuietly(con, offline, rs);
  1588. +       }
  1589. +   }
  1590. +  
  1591. +   public boolean saveSkins()
  1592. +   {
  1593. +       Connection con = null;
  1594. +       PreparedStatement offline = null;
  1595. +       ResultSet rs = null;
  1596. +      
  1597. +       if (skins == null)
  1598. +       {
  1599. +           skins = new ArrayList<>();
  1600. +       }
  1601. +      
  1602. +       try
  1603. +       {
  1604. +           con = L2DatabaseFactory.getInstance().getConnection();
  1605. +           PreparedStatement statement = con.prepareStatement("DELETE FROM player_skins WHERE char_id=?");
  1606. +           statement.setInt(1, getObjectId());
  1607. +           statement.execute();
  1608. +           statement = con.prepareStatement("INSERT INTO player_skins (char_id,skin_id) VALUES (?,?)");
  1609. +           for (Skin skin : getSkins())
  1610. +           {
  1611. +               statement.setInt(1, getObjectId());
  1612. +               statement.setInt(2, skin.getId());
  1613. +               statement.execute();
  1614. +           }
  1615. +           con.close();
  1616. +           return true;
  1617. +       }
  1618. +       catch (Exception e)
  1619. +       {
  1620. +           e.printStackTrace();
  1621. +           return false;
  1622. +       }
  1623. +       finally
  1624. +       {
  1625. +           Mysql.closeQuietly(con, offline, rs);
  1626. +       }
  1627. +   }
  1628. +  
  1629.     public void setFakeArmorObjectId(int objectId)
  1630.     {
  1631.         _fakeArmorObjectId = objectId;
  1632. diff --git a/src/l2jorion/game/network/clientpackets/RequestBypassToServer.java b/src/l2jorion/game/network/clientpackets/RequestBypassToServer.java
  1633. index 7bb0cf1..54d3fd4 100644
  1634. --- a/src/l2jorion/game/network/clientpackets/RequestBypassToServer.java
  1635. +++ b/src/l2jorion/game/network/clientpackets/RequestBypassToServer.java
  1636. @@ -23,7 +23,10 @@
  1637.  import java.sql.ResultSet;
  1638.  import java.text.NumberFormat;
  1639.  import java.util.StringTokenizer;
  1640. +import java.util.concurrent.ScheduledFuture;
  1641.  
  1642. +import Base.SkinBeauty.Skin;
  1643. +import Base.SkinBeauty.SkinData;
  1644.  import javolution.text.TextBuilder;
  1645.  import l2jorion.Config;
  1646.  import l2jorion.game.community.CommunityBoard;
  1647. @@ -47,6 +50,7 @@
  1648.  import l2jorion.game.model.L2Object;
  1649.  import l2jorion.game.model.L2Skill;
  1650.  import l2jorion.game.model.L2World;
  1651. +import l2jorion.game.model.actor.instance.L2BeautyShopInstance;
  1652.  import l2jorion.game.model.actor.instance.L2ClassMasterInstance;
  1653.  import l2jorion.game.model.actor.instance.L2GrandBossInstance;
  1654.  import l2jorion.game.model.actor.instance.L2ItemInstance;
  1655. @@ -71,6 +75,7 @@
  1656.  import l2jorion.game.network.serverpackets.PlaySound;
  1657.  import l2jorion.game.network.serverpackets.SystemMessage;
  1658.  import l2jorion.game.templates.L2Item;
  1659. +import l2jorion.game.thread.ThreadPoolManager;
  1660.  import l2jorion.game.util.GMAudit;
  1661.  import l2jorion.game.util.Util;
  1662.  import l2jorion.log.Log;
  1663. @@ -107,6 +112,9 @@
  1664.             return;
  1665.         }
  1666.        
  1667. +       StringTokenizer stSkin = new StringTokenizer(this._command, " ");
  1668. +       stSkin.nextToken();
  1669. +      
  1670.         try
  1671.         {
  1672.             if (_command.startsWith("admin_"))
  1673. @@ -572,6 +580,123 @@
  1674.                    
  1675.                 }
  1676.             }
  1677. +          
  1678. +           else if (this._command.startsWith("skinPage"))
  1679. +           {
  1680. +               int page = Integer.parseInt(stSkin.nextToken());
  1681. +               showMainWindow(activeChar, page);
  1682. +           }
  1683. +           else if (this._command.startsWith("skinHat"))
  1684. +           {
  1685. +               if (activeChar.isActiveHat())
  1686. +               {
  1687. +                   activeChar.setActiveHat(false);
  1688. +               }
  1689. +           }
  1690. +           else if (this._command.startsWith("acquireSkin"))
  1691. +           {
  1692. +               int id = Integer.parseInt(stSkin.nextToken());
  1693. +               Skin skin = SkinData.getInstance().getSkinById(id);
  1694. +               if (skin != null)
  1695. +               {
  1696. +                   if (activeChar.getSkins().contains(skin))
  1697. +                   {
  1698. +                       activeChar.sendMessage("Skin " + skin.getName() + " already acquired. Try other!");
  1699. +                       showSkinWindow(activeChar, skin);
  1700. +                       return;
  1701. +                   }
  1702. +                   if (skin.isVip())
  1703. +                   {
  1704. +                       if (activeChar.isDonator())
  1705. +                       {
  1706. +                           if (L2BeautyShopInstance.reduceItem(activeChar, skin.getPriceId(), skin.getPrice()) && activeChar.getSkins().add(skin))
  1707. +                           {
  1708. +                               activeChar.sendMessage("Skin " + skin.getStats().getString("name") + " acquired!");
  1709. +                               showSkinWindow(activeChar, skin);
  1710. +                           }
  1711. +                       }
  1712. +                       else
  1713. +                       {
  1714. +                           activeChar.sendMessage("This skin is only for Vip Players!");
  1715. +                           showSkinWindow(activeChar, skin);
  1716. +                           return;
  1717. +                       }
  1718. +                   }
  1719. +                   else if (L2BeautyShopInstance.reduceItem(activeChar, skin.getPriceId(), skin.getPrice()) && activeChar.getSkins().add(skin))
  1720. +                   {
  1721. +                       activeChar.sendMessage("Skin " + skin.getName() + " acquired!");
  1722. +                       showSkinWindow(activeChar, skin);
  1723. +                   }
  1724. +               }
  1725. +           }
  1726. +           else if (this._command.startsWith("trySkin"))
  1727. +           {
  1728. +               if (activeChar.visualizationTime > 0)
  1729. +               {
  1730. +                   activeChar.sendMessage("You already Trying a Skin!");
  1731. +                   return;
  1732. +               }
  1733. +               activeChar.visualizationTime = 5;
  1734. +               int id = Integer.parseInt(stSkin.nextToken());
  1735. +               L2BeautyShopInstance.equipSkin(activeChar, id, true);
  1736. +               activeChar.visualTask = startCounter(activeChar);
  1737. +           }
  1738. +           else if (this._command.startsWith("skinhtm"))
  1739. +           {
  1740. +               int id = Integer.parseInt(stSkin.nextToken());
  1741. +               Skin skin = SkinData.getInstance().getSkinById(id);
  1742. +               showSkinWindow(activeChar, skin);
  1743. +           }
  1744. +           else if (this._command.startsWith("equipSkin"))
  1745. +           {
  1746. +               int id = Integer.parseInt(stSkin.nextToken());
  1747. +               L2BeautyShopInstance.equipSkin(activeChar, id, false);
  1748. +               showSkinWindow(activeChar, SkinData.getInstance().getSkinById(id));
  1749. +           }
  1750. +           else if (this._command.startsWith("unequipSkin"))
  1751. +           {
  1752. +               int id = Integer.parseInt(stSkin.nextToken());
  1753. +               if (activeChar.isDressMeEnabled())
  1754. +               {
  1755. +                   Skin dress = SkinData.getInstance().getSkinById(0);
  1756. +                   activeChar.setActiveHat(false);
  1757. +                   activeChar.setDressMeEnabled(false);
  1758. +                   activeChar.broadcastUserInfo();
  1759. +                   activeChar.setSkinId(0);
  1760. +                   activeChar.setActiveSkin(dress);
  1761. +                   activeChar.sendMessage("Skin unequiped!");
  1762. +                   showSkinWindow(activeChar, SkinData.getInstance().getSkinById(id));
  1763. +               }
  1764. +               else
  1765. +               {
  1766. +                   activeChar.sendMessage("You don't have any skin equiped!");
  1767. +                   showMainWindow(activeChar, 0);
  1768. +                   return;
  1769. +               }
  1770. +           }
  1771. +           else if (this._command.startsWith("activeHat"))
  1772. +           {
  1773. +               if (!activeChar.isDressMeEnabled())
  1774. +               {
  1775. +                   activeChar.sendMessage("You don't have any skin equiped! First Equip a Skin!");
  1776. +                   showMainWindow(activeChar, 0);
  1777. +                   return;
  1778. +               }
  1779. +               if (activeChar.isActiveHat())
  1780. +               {
  1781. +                   activeChar.setActiveHat(false);
  1782. +                   activeChar.setDressMeEnabled(true);
  1783. +                   activeChar.broadcastUserInfo();
  1784. +               }
  1785. +               else
  1786. +               {
  1787. +                   activeChar.setActiveHat(true);
  1788. +                   activeChar.setDressMeEnabled(true);
  1789. +                   activeChar.broadcastUserInfo();
  1790. +               }
  1791. +               showMainWindow(activeChar, 0);
  1792. +           }
  1793. +          
  1794.             // Draw a Symbol
  1795.             else if (_command.equals("Draw"))
  1796.             {
  1797. @@ -1278,6 +1403,83 @@
  1798.         sendEditWindow(p, part);
  1799.     }
  1800.    
  1801. +   public static void showSkinWindow(L2PcInstance player, Skin skin)
  1802. +   {
  1803. +       String filename = "data/html/SkinManager/Skin.htm";
  1804. +       NpcHtmlMessage html = new NpcHtmlMessage(0);
  1805. +       html.setFile(filename);
  1806. +       html.replace("%hat%", player.isActiveHat() ? "<font color=\"00ff00\">ON</font>" : "<font color=\"ff0000\">OFF</font>");
  1807. +       html.replace("%showbutton%", L2BeautyShopInstance.showButtons(player, skin));
  1808. +       html.replace("%skinprice%", skin.getPrice());
  1809. +       html.replace("%skinpriceid%", skin.getPriceItemName());
  1810. +       html.replace("%skiname%", skin.getName());
  1811. +       html.replace("%icon%", "<img src=\"MAYKE_MENDES_SKIN" + L2BeautyShopInstance.getIconPath(player, skin) + "\" width=32 height=32/>");
  1812. +       html.replace("%skinstatus%", player.containsSkin(skin) ? "<font color=\"LEVEL\">Already Acquired</font>" : "Not Acquired");
  1813. +       html.replace("%skinvip%", skin.isVip() ? "<font color=\"00ff00\">TRUE</font>" : "<font color=\"ff0000\">FALSE</font>");
  1814. +       player.sendPacket(html);
  1815. +   }
  1816. +  
  1817. +   public void showMainWindow(L2PcInstance player, int page)
  1818. +   {
  1819. +       String filename = "data/html/SkinManager/Main.htm";
  1820. +       NpcHtmlMessage html = new NpcHtmlMessage(0);
  1821. +       html.setFile(filename);
  1822. +       html.replace("%hat%", player.isActiveHat() ? "ON" : "OFF");
  1823. +       html.replace("%skins%", L2BeautyShopInstance.generateSkinsHtml(player, page));
  1824. +       html.replace("%pages%", L2BeautyShopInstance.generatePagesHtml(player));
  1825. +       player.sendPacket(html);
  1826. +       filename = null;
  1827. +       html = null;
  1828. +   }
  1829. +  
  1830. +   class Counter implements Runnable
  1831. +   {
  1832. +       L2PcInstance p;
  1833. +      
  1834. +       int id;
  1835. +      
  1836. +       Counter(L2PcInstance p)
  1837. +       {
  1838. +           this.p = p;
  1839. +       }
  1840. +      
  1841. +       @Override
  1842. +       public void run()
  1843. +       {
  1844. +           if (this.p.visualizationTime >= 0)
  1845. +           {
  1846. +               this.p.sendPacket(new ExShowScreenMessage("Current skin visualization will end in: " + this.p.visualizationTime, 1100));
  1847. +           }
  1848. +           else
  1849. +           {
  1850. +               if (p.getSkinId() == 0)
  1851. +               {
  1852. +                   Skin dress = SkinData.getInstance().getSkinById(id);
  1853. +                   p.setActiveSkin(dress);
  1854. +               }
  1855. +               this.p.setSkinId(0);
  1856. +               Skin dress = SkinData.getInstance().getSkinById(0);
  1857. +               p.setActiveSkin(dress);
  1858. +               this.p.setDressMeEnabled(false);
  1859. +               this.p.broadcastUserInfo();
  1860. +               this.p.sendPacket(new ExShowScreenMessage("Current skin visualization time it's over!", 2000));
  1861. +               RequestBypassToServer.stopCounter(this.p.visualTask);
  1862. +           }
  1863. +           this.p.visualizationTime--;
  1864. +       }
  1865. +   }
  1866. +  
  1867. +   public static void stopCounter(ScheduledFuture<?> task)
  1868. +   {
  1869. +       task.cancel(true);
  1870. +       task = null;
  1871. +   }
  1872. +  
  1873. +   public ScheduledFuture<?> startCounter(L2PcInstance player)
  1874. +   {
  1875. +       return ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new Counter(player), 1000L, 1000L);
  1876. +   }
  1877. +  
  1878.     public void sendEditWindow(L2PcInstance p, String part)
  1879.     {
  1880.         NpcHtmlMessage htm = new NpcHtmlMessage(0);
  1881. diff --git a/src/l2jorion/game/network/serverpackets/CharInfo.java b/src/l2jorion/game/network/serverpackets/CharInfo.java
  1882. index a8bf3be..c7eda05 100644
  1883. --- a/src/l2jorion/game/network/serverpackets/CharInfo.java
  1884. +++ b/src/l2jorion/game/network/serverpackets/CharInfo.java
  1885. @@ -23,6 +23,7 @@
  1886.  import java.util.Map;
  1887.  import java.util.Set;
  1888.  
  1889. +import Base.SkinBeauty.Skin;
  1890.  import l2jorion.Config;
  1891.  import l2jorion.game.datatables.sql.NpcTable;
  1892.  import l2jorion.game.managers.CursedWeaponsManager;
  1893. @@ -182,18 +183,38 @@
  1894.                 writeD(_activeChar.getBaseClass());
  1895.             }
  1896.            
  1897. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  1898. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  1899. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1900. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  1901. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  1902. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  1903. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  1904. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  1905. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  1906. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1907. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  1908. -           writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  1909. +           final Skin dress = _activeChar.getActiveSkin();
  1910. +          
  1911. +           if (!_activeChar.isDressMeEnabled())
  1912. +           {
  1913. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  1914. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  1915. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1916. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  1917. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  1918. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  1919. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  1920. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  1921. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  1922. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1923. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  1924. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  1925. +           }
  1926. +           else
  1927. +           {
  1928. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  1929. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  1930. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1931. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  1932. +               writeD(dress != null ? dress.getGloves() : _inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  1933. +               writeD(dress != null ? dress.getChest() : _inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  1934. +               writeD(dress != null ? dress.getLegs() : _inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  1935. +               writeD(dress != null ? dress.getFeet() : _inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  1936. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  1937. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1938. +               writeD(dress != null ? dress.getHair() : _inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  1939. +               writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  1940. +           }
  1941.            
  1942.             // c6 new h's
  1943.             writeH(0x00);
  1944. diff --git a/src/l2jorion/game/network/serverpackets/UserInfo.java b/src/l2jorion/game/network/serverpackets/UserInfo.java
  1945. index 7ec8b56..a04983d 100644
  1946. --- a/src/l2jorion/game/network/serverpackets/UserInfo.java
  1947. +++ b/src/l2jorion/game/network/serverpackets/UserInfo.java
  1948. @@ -20,6 +20,7 @@
  1949.   */
  1950.  package l2jorion.game.network.serverpackets;
  1951.  
  1952. +import Base.SkinBeauty.Skin;
  1953.  import l2jorion.Config;
  1954.  import l2jorion.game.datatables.sql.NpcTable;
  1955.  import l2jorion.game.managers.CursedWeaponsManager;
  1956. @@ -114,42 +115,84 @@
  1957.         writeD(_activeChar.getMaxLoad());
  1958.        
  1959.         writeD(_activeChar.getActiveWeaponItem() != null ? 40 : 20); // 20 no weapon, 40 weapon equippe
  1960. +       final Skin dress = _activeChar.getActiveSkin();
  1961.        
  1962. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR));
  1963. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR));
  1964. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR));
  1965. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK));
  1966. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER));
  1967. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER));
  1968. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD));
  1969. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  1970. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  1971. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  1972. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  1973. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  1974. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  1975. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  1976. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  1977. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  1978. -       writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  1979. -      
  1980. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  1981. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR));
  1982. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
  1983. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK));
  1984. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
  1985. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
  1986. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  1987. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1988. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  1989. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  1990. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  1991. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  1992. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  1993. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  1994. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  1995. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  1996. -       writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  1997. +       if (!_activeChar.isDressMeEnabled())
  1998. +       {
  1999. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR));
  2000. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR));
  2001. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR));
  2002. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK));
  2003. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER));
  2004. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER));
  2005. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD));
  2006. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  2007. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  2008. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  2009. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  2010. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  2011. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  2012. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  2013. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  2014. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  2015. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  2016. +          
  2017. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  2018. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR));
  2019. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
  2020. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK));
  2021. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
  2022. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
  2023. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  2024. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2025. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  2026. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  2027. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  2028. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  2029. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  2030. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  2031. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2032. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  2033. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  2034. +       }
  2035. +       else
  2036. +       {
  2037. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR));
  2038. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR));
  2039. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR));
  2040. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK));
  2041. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER));
  2042. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER));
  2043. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD));
  2044. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  2045. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  2046. +           writeD(dress != null ? dress.getGloves() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  2047. +           writeD(dress != null ? dress.getChest() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  2048. +           writeD(dress != null ? dress.getLegs() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  2049. +           writeD(dress != null ? dress.getFeet() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  2050. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  2051. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  2052. +           writeD(dress != null ? dress.getHair() : _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  2053. +           writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  2054. +          
  2055. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
  2056. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR));
  2057. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
  2058. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK));
  2059. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
  2060. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
  2061. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  2062. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2063. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  2064. +           writeD(dress != null ? dress.getGloves() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  2065. +           writeD(dress != null ? dress.getChest() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  2066. +           writeD(dress != null ? dress.getLegs() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  2067. +           writeD(dress != null ? dress.getFeet() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  2068. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  2069. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  2070. +           writeD(dress != null ? dress.getHair() : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  2071. +           writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  2072. +       }
  2073.        
  2074.         writeH(0x00);
  2075.         writeH(0x00);
  2076.  
Advertisement
Comments
  • tensador125
    1 year
    # SQL 0.69 KB | 0 0
    1. /*
    2. Navicat MySQL Data Transfer
    3.  
    4. Source Server         : localhost
    5. Source Server Version : 50521
    6. Source Host           : localhost:3306
    7. Source Database       : project
    8.  
    9. Target Server Type    : MYSQL
    10. Target Server Version : 50521
    11. File Encoding         : 65001
    12.  
    13. Date: 2023-04-09 15:48:30
    14. */
    15.  
    16. SET FOREIGN_KEY_CHECKS=0;
    17.  
    18. -- ----------------------------
    19. -- Table structure for player_skins
    20. -- ----------------------------
    21. DROP TABLE IF EXISTS `player_skins`;
    22. CREATE TABLE `player_skins` (
    23.   `char_id` INT(11) DEFAULT NULL,
    24.   `skin_id` INT(11) DEFAULT NULL
    25. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    26.  
    27. -- ----------------------------
    28. -- Records of player_skins
    29. -- ----------------------------
    30.  
Add Comment
Please, Sign In to add comment
Advertisement