Advertisement
VANPER

Visual Skins

Apr 8th, 2020
1,677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.77 KB | None | 0 0
  1. Index: Dev.VisualSkins.Visual.java
  2. ===================================================================
  3. --- Dev.VisualSkins.Visual.java (revision 384)
  4. +++ Dev.VisualSkins.Visual.java (working copy)
  5.  
  6. +   package Dev.VisualSkins;
  7. +  
  8. +   import net.sf.l2j.gameserver.handler.IItemHandler;
  9. +   import net.sf.l2j.gameserver.model.actor.Playable;
  10. +   import net.sf.l2j.gameserver.model.actor.Player;
  11. +   import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  12. +   import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  13. +  
  14. +   /**
  15. +    * @author COMBATE
  16. +    * @author Juvenil Amaro
  17. +    */
  18. +   public class Visual implements IItemHandler
  19. +   {
  20. +       @Override
  21. +       public void useItem(Playable playable, ItemInstance item, boolean forceUse)
  22. +       {
  23. +           if (!(playable instanceof Player))
  24. +               return;
  25. +          
  26. +           Player player = (Player) playable;
  27. +           int itemId = item.getItemId();
  28. +           switch(itemId)
  29. +           {
  30. +               case 26101:
  31. +               case 26111:
  32. +               case 26121:
  33. +                   player.broadcastPacket(new MagicSkillUse(player, 1410, 1, 10000, 10000));
  34. +                   player.setVisual(player.getVisual() == 1 ? 0 : 1);
  35. +                   break;
  36. +               case 26102:
  37. +               case 26112:
  38. +               case 26122:
  39. +                   player.setVisual(player.getVisual() == 2 ? 0 : 2);
  40. +                   break;
  41. +               case 26103:
  42. +               case 26113:
  43. +               case 26123:
  44. +                   player.setVisual(player.getVisual() == 3 ? 0 : 3);
  45. +                   break;
  46. +               case 26104:
  47. +               case 26114:
  48. +               case 26124:
  49. +                   player.setVisual(player.getVisual() == 4 ? 0 : 4);
  50. +                   break;
  51. +               case 26105:
  52. +               case 26115:
  53. +               case 26125:
  54. +                   player.setVisual(player.getVisual() == 5 ? 0 : 5);
  55. +                   break;
  56. +               case 23881:
  57. +                   player.setVisual(player.getVisual() == 6 ? 0 : 6);
  58. +                   break;
  59. +           }
  60. +       }
  61. +   }
  62. +  
  63.  
  64. Index: net.sf.l2j.gameserver.model.actor.instance;Merchant.java
  65. ===================================================================
  66. --- net.sf.l2j.gameserver.model.actor.instance;Merchant.java (revision 384)
  67. +++ net.sf.l2j.gameserver.model.actor.instance;Merchant.java (working copy)
  68.  
  69. +   else if (currentCommand.startsWith("visualTest"))
  70. +   {
  71. +       if (player.getVisualTest() > 0)
  72. +       {
  73. +           player.sendMessage("You are already trying on a uniform, please wait till it finishes.");
  74. +           return;
  75. +       }
  76. +      
  77. +           player.broadcastPacket(new MagicSkillUse(player, 1410, 1, 1000, 1000));
  78. +           player.setDressMeEnabled(false);
  79. +           int uniform = Integer.parseInt(command.substring(11));
  80. +           player.setVisualTest(uniform);
  81. +           ThreadPool.schedule(() -> player.setVisualTest(0), 1000 * 15);
  82. +           player.broadcastUserInfo();
  83. +          
  84. +  
  85. +  
  86. +   }
  87.  
  88. Index: net.sf.l2j.gameserver.network.serverpackets;UserInfo.java
  89. ===================================================================
  90. --- net.sf.l2j.gameserver.network.serverpackets;UserInfo.java (revision 384)
  91. +++ net.sf.l2j.gameserver.network.serverpackets;UserInfo.java (working copy)
  92.  
  93. +   writeD(_activeChar.visual_test_chest > 0 ? _activeChar.visual_test_chest : (_activeChar.visual_chest > 0 ? _activeChar.visual_chest : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST)));
  94. +  
  95. +   writeD(_activeChar.visual_test_hair > 0 ? _activeChar.visual_test_hair : (_activeChar.visual_hair > 0 ? _activeChar.visual_hair : _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR)));
  96.  
  97. Index: net.sf.l2j.gameserver.model.actor;Player.java
  98. ===================================================================
  99. --- net.sf.l2j.gameserver.model.actor;Player.java (revision 384)
  100. +++ net.sf.l2j.gameserver.model.actor;Player.java (working copy)
  101.  
  102. +   private int visual = 0;
  103. +   private int visualTest = 0;
  104. +
  105. +   // Testing
  106. +   public int visual_test_hair = 0;
  107. +   public int visual_test_chest = 0;
  108. +  
  109. +   public int visual_hair = 0;
  110. +   public int visual_chest = 0;
  111. +  
  112. +   public void setVisualTest(int val)
  113. +   {
  114. +       // HARDCODED FOR NOW
  115. +       switch(val)
  116. +       {
  117. +           case 0:
  118. +               visual_test_hair = 0;
  119. +               visual_test_chest = 0;
  120. +               break;
  121. +          
  122. +           case 1: // Draconic
  123. +               visual_test_hair = 26201;
  124. +               visual_test_chest = 26101;
  125. +               break;
  126. +           case 2:
  127. +               visual_test_hair = 26202;
  128. +               visual_test_chest = 26102;
  129. +               break;
  130. +           case 3:
  131. +               visual_test_hair = 26203;
  132. +               visual_test_chest = 26103;
  133. +               break;
  134. +           case 4:
  135. +               visual_test_hair = 26204;
  136. +               visual_test_chest = 26104;
  137. +               break;
  138. +           case 5:
  139. +               visual_test_hair = 26205;
  140. +               visual_test_chest = 26105;
  141. +               break;
  142. +           case 6:
  143. +               visual_test_hair = 0;
  144. +               visual_test_chest = 23881;
  145. +               break;
  146. +       }
  147. +      
  148. +       visualTest = val;
  149. +       broadcastUserInfo();
  150. +   }
  151. +  
  152. +   public int getVisualTest()
  153. +   {
  154. +       return visualTest;
  155. +   }
  156. +  
  157. +   public void setVisual(int val)
  158. +   {
  159. +       // HARDCODED FOR NOW
  160. +       switch(val)
  161. +       {
  162. +           case 0:
  163. +               visual_hair = 0;
  164. +               visual_chest = 0;
  165. +               break;
  166. +                  
  167. +           case 1:
  168. +               visual_hair = 26201;
  169. +               visual_chest = 26101;
  170. +               break;
  171. +           case 2:
  172. +               visual_hair = 26202;
  173. +               visual_chest = 26102;
  174. +               break;
  175. +           case 3:
  176. +               visual_hair = 26203;
  177. +               visual_chest = 26103;
  178. +               break;
  179. +           case 4:
  180. +               visual_hair = 26204;
  181. +               visual_chest = 26104;
  182. +               break;
  183. +           case 5:
  184. +               visual_hair = 26205;
  185. +               visual_chest = 26105;
  186. +               break;
  187. +           case 6:
  188. +               visual_hair = 0;
  189. +               visual_chest = 23881;
  190. +               break;
  191. +       }
  192. +      
  193. +       visual = val;
  194. +       broadcastUserInfo();
  195. +   }
  196. +  
  197. +   public int getVisual()
  198. +   {
  199. +       return visual;
  200. +   }
  201. +
  202.  
  203. Index: net.sf.l2j.gameserver.handler;ItemHandler.java
  204. ===================================================================
  205. --- net.sf.l2j.gameserver.handler;ItemHandler.java(revision 384)
  206. +++ net.sf.l2j.gameserver.handler;ItemHandler.java (working copy)
  207.  
  208. +   registerHandler(new Visual());
  209.  
  210. Index: data/html/merchant
  211. ===================================================================
  212. --- data/html/merchant (revision 384)
  213. +++ data/html/merchant (working copy)
  214.  
  215. +   <html>
  216. +   <title>Beauty Shop</title>
  217. +   <body>
  218. +   <center>
  219. +   <table cellpadding=-15 cellspacing=0>
  220. +   <tr>
  221. +   <td width=20></td>
  222. +   <td><img src="TestLogo2.LogoTest2" width=210 height=145></td>
  223. +   </tr>
  224. +   </table>
  225. +   <img src="L2UI.SquareGray" width=295 height=2>
  226. +   <table width=295 bgcolor="000000">
  227. +   <tr>
  228. +   <td align=center><font color="CCCC66">You can try the Accesory before you buy it for 15 Seconds!</font></td>
  229. +   </tr>
  230. +   <tr>
  231. +   <td align=center><font color="CCCC66">Choose which accesory you want before you pay for it!</font></td>
  232. +   </tr>
  233. +   <tr></tr>
  234. +   <tr>
  235. +   <td align=center><button value="Try White Assassin" action="bypass -h npc_%objectId%_visualTest 3" width=204 height=19 back="eola.btn_over" fore="eola.btn">
  236. +   </td>
  237. +   </tr>
  238. +   <tr>
  239. +   <td align=center><button value="Try Dark Assassin" action="bypass -h npc_%objectId%_visualTest 4" width=204 height=19 back="eola.btn_over" fore="eola.btn"></td>
  240. +   </tr>
  241. +   <tr>
  242. +   <td align=center><button value="Try Dark Killer" action="bypass -h npc_%objectId%_visualTest 2" width=204 height=19 back="eola.btn_over" fore="eola.btn"></td>
  243. +   </tr>
  244. +   <tr>
  245. +   <td align=center><button value="Try Beleth Costume" action="bypass -h npc_%objectId%_visualTest 5" width=204 height=19 back="eola.btn_over" fore="eola.btn"></td>
  246. +   </tr>
  247. +   <tr>
  248. +   <td align=center><button value="Try Draconic Suit" action="bypass -h npc_%objectId%_visualTest 1" width=204 height=19 back="eola.btn_over" fore="eola.btn"></td>
  249. +   </tr>
  250. +   <tr>
  251. +   <td align=center><button value="Try Anakim Costume" action="bypass -h npc_%objectId%_visualTest 6" width=204 height=19 back="eola.btn_over" fore="eola.btn"></td>
  252. +   </tr>
  253. +   </table>
  254. +   <img src="L2UI.SquareGray" width=295 height=2>
  255. +   <br>
  256. +   <button value="Buy Uniforms" action="bypass -h npc_%objectId%_multisell 3259" width=204 height=19 back="eola.btn_over" fore="eola.btn">
  257. +  
  258. +   <br>
  259. +   <br1>
  260. +   <button value="Back" action="bypass -h npc_%objectId%_Chat 0" width=204 height=19 back="eola.btn_over" fore="eola.btn">
  261. +  
  262. +   <br>
  263. +  
  264. +   </center>
  265. +   </body>
  266. +   </html>
  267. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement