Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- public static boolean ENABLE_CHANGESEX_COIN;
- public static int CHANGESEX_COIN_ID;
- public static int CHANGESEX_COIN_AMOUNT;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
- EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("EnableChangeSexItem", "True"));
- CHANGESEX_COIN_ID = Integer.parseInt(otherSettings.getProperty("ChangeSexCoinId", "57"));
- CHANGESEX_COIN_AMOUNT = Integer.parseInt(otherSettings.getProperty("ChangeSexCoinAmount", "1000"));
- ===================================================================
- Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package com.l2jfrozen.gameserver.handler.itemhandlers;
- import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.handler.IItemHandler;
- import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
- import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
- import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
- import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate;
- import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
- /**
- * @author ???????
- */
- public class ChangeSexItem implements IItemHandler
- {
- private static final int ITEM_IDS[] =
- {
- Config.CHANGESEX_COIN_ID
- };
- @Override
- public void useItem(L2PlayableInstance playable, final L2ItemInstance item)
- {
- if (!(playable instanceof L2PcInstance))
- {
- return;
- }
- final L2PcInstance activeChar = (L2PcInstance)playable;
- if (activeChar.isInOlympiadMode())
- {
- activeChar.sendMessage("This Item Cannot Be Used On Olympiad Games.");
- }
- else
- {
- 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))
- {
- activeChar.getInventory().destroyItemByItemId("GoldDragon", Config.CHANGESEX_COIN_ID, Config.CHANGESEX_COIN_AMOUNT, activeChar, activeChar.getTarget());
- activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
- activeChar.getAppearance().setSex(!activeChar.getAppearance().getSex());
- L2PcInstance.setSexDB(activeChar, 1);
- activeChar.sendMessage("Congratulations your sex has changed !!! ");
- activeChar.sendMessage("Please do restart");
- activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
- activeChar.sendPacket(new InventoryUpdate());
- activeChar.sendPacket(new StatusUpdate(activeChar));
- activeChar.sendMessage("Your gender has been changed,You will Be Disconected in 3 Seconds!");
- activeChar.broadcastUserInfo();
- activeChar.decayMe();
- activeChar.spawnMe();
- ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- {
- @Override
- public void run()
- {
- activeChar.logout(false);
- }
- }, 3000);
- }
- }
- return;
- }
- @Override
- public int[] getItemIds()
- {
- return ITEM_IDS;
- }
- }
- ===================================================================
- Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (revision 1132)
- +++ head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java (working copy)
- @@ -32,6 +32,7 @@
- import com.l2jfrozen.gameserver.handler.itemhandlers.BlessedSpiritShot;
- import com.l2jfrozen.gameserver.handler.itemhandlers.Book;
- import com.l2jfrozen.gameserver.handler.itemhandlers.BreakingArrow;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.ChangeSexItem;
- import com.l2jfrozen.gameserver.handler.itemhandlers.CharChangePotions;
- import com.l2jfrozen.gameserver.handler.itemhandlers.ChestKey;
- import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
- @@ -152,6 +153,7 @@
- registerItemHandler(new BreakingArrow());
- registerItemHandler(new ChristmasTree());
- registerItemHandler(new Crystals());
- + registerItemHandler(new ChangeSexItem());
- LOGGER.info("ItemHandler: Loaded " + _datatable.size() + " handlers.");
- }
- ===================================================================
- Index: gameserver\config\other.properties
- ===================================================================
- ##############################
- #/////Change Sex System//////#
- ##############################
- #True = Enable/Fale = Disabled
- EnableChangeSexItem = True
- #Item ID
- ChangeSexCoinId = 3481
- #Item Count
- ChangeSexCoinAmount = 2
- //////no new line///////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement