Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.86 KB | None | 0 0
  1. Index: head-src/com/l2jfrozen/Config.java
  2. ===================================================================
  3.  
  4. public static boolean ENABLE_CHANGESEX_COIN;
  5. public static int CHANGESEX_COIN_ID;
  6. public static int CHANGESEX_COIN_AMOUNT;
  7.  
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  9.  
  10. EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("EnableChangeSexItem", "True"));
  11. CHANGESEX_COIN_ID = Integer.parseInt(otherSettings.getProperty("ChangeSexCoinId", "57"));
  12. CHANGESEX_COIN_AMOUNT = Integer.parseInt(otherSettings.getProperty("ChangeSexCoinAmount", "1000"));
  13.  
  14. ===================================================================
  15. Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
  16. ===================================================================
  17. /*
  18. * This program is free software: you can redistribute it and/or modify it under
  19. * the terms of the GNU General Public License as published by the Free Software
  20. * Foundation, either version 3 of the License, or (at your option) any later
  21. * version.
  22. *
  23. * This program is distributed in the hope that it will be useful, but WITHOUT
  24. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  25. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  26. * details.
  27. *
  28. * You should have received a copy of the GNU General Public License along with
  29. * this program. If not, see <http://www.gnu.org/licenses/>.
  30. */
  31. package com.l2jfrozen.gameserver.handler.itemhandlers;
  32.  
  33. import com.l2jfrozen.Config;
  34. import com.l2jfrozen.gameserver.handler.IItemHandler;
  35. import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  36. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  37. import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  38. import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
  39. import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
  40. import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate;
  41. import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  42.  
  43. /**
  44. * @author ???????
  45. */
  46. public class ChangeSexItem implements IItemHandler
  47. {
  48.  
  49. private static final int ITEM_IDS[] =
  50. {
  51. Config.CHANGESEX_COIN_ID
  52. };
  53.  
  54. @Override
  55. public void useItem(L2PlayableInstance playable, final L2ItemInstance item)
  56. {
  57.  
  58. if (!(playable instanceof L2PcInstance))
  59. {
  60. return;
  61. }
  62. final L2PcInstance activeChar = (L2PcInstance)playable;
  63. if (activeChar.isInOlympiadMode())
  64. {
  65. activeChar.sendMessage("This Item Cannot Be Used On Olympiad Games.");
  66. }
  67.  
  68. else
  69. {
  70. if ( Config.ENABLE_CHANGESEX_COIN || (activeChar.getInventory().getItemByItemId(Config.CHANGESEX_COIN_ID) != null) && (activeChar.getInventory().getItemByItemId(Config.CHANGESEX_COIN_ID).getCount() >= Config.CHANGESEX_COIN_AMOUNT))
  71. {
  72. activeChar.getInventory().destroyItemByItemId("GoldDragon", Config.CHANGESEX_COIN_ID, Config.CHANGESEX_COIN_AMOUNT, activeChar, activeChar.getTarget());
  73. activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
  74. activeChar.getAppearance().setSex(!activeChar.getAppearance().getSex());
  75. L2PcInstance.setSexDB(activeChar, 1);
  76. activeChar.sendMessage("Congratulations your sex has changed !!! ");
  77. activeChar.sendMessage("Please do restart");
  78. activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
  79. activeChar.sendPacket(new InventoryUpdate());
  80. activeChar.sendPacket(new StatusUpdate(activeChar));
  81. activeChar.sendMessage("Your gender has been changed,You will Be Disconected in 3 Seconds!");
  82. activeChar.broadcastUserInfo();
  83. activeChar.decayMe();
  84. activeChar.spawnMe();
  85. ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  86. {
  87. @Override
  88. public void run()
  89. {
  90. activeChar.logout(false);
  91. }
  92. }, 3000);
  93. }
  94. }
  95. return;
  96.  
  97. }
  98.  
  99. @Override
  100. public int[] getItemIds()
  101. {
  102. return ITEM_IDS;
  103. }
  104. }
  105.  
  106. ===================================================================
  107. Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
  108. ===================================================================
  109. --- head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (revision 1132)
  110. +++ head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (working copy)
  111. @@ -32,6 +32,7 @@
  112. import com.l2jfrozen.gameserver.handler.itemhandlers.BlessedSpiritShot;
  113. import com.l2jfrozen.gameserver.handler.itemhandlers.Book;
  114. import com.l2jfrozen.gameserver.handler.itemhandlers.BreakingArrow;
  115. +import com.l2jfrozen.gameserver.handler.itemhandlers.ChangeSexItem;
  116. import com.l2jfrozen.gameserver.handler.itemhandlers.CharChangePotions;
  117. import com.l2jfrozen.gameserver.handler.itemhandlers.ChestKey;
  118. import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
  119. @@ -152,6 +153,7 @@
  120. registerItemHandler(new BreakingArrow());
  121. registerItemHandler(new ChristmasTree());
  122. registerItemHandler(new Crystals());
  123. + registerItemHandler(new ChangeSexItem());
  124. LOGGER.info("ItemHandler: Loaded " + _datatable.size() + " handlers.");
  125. }
  126.  
  127. ===================================================================
  128. Index: gameserver\config\other.properties
  129. ===================================================================
  130. ##############################
  131. #/////Change Sex System//////#
  132. ##############################
  133. #True = Enable/Fale = Disabled
  134. EnableChangeSexItem = True
  135. #Item ID
  136. ChangeSexCoinId = 3481
  137. #Item Count
  138. ChangeSexCoinAmount = 2
  139. //////no new line///////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement