Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: head-src/com/l2jfrozen/gameserver/handler/ItemHandler/ChangeSexItem.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.L2Character;
- +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.ExShowScreenMessage;
- +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;
- +
- +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 (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
- + activeChar.sendMessage("You can only use this item in peace zone..");
- + return;
- + }
- +
- + activeChar.getInventory().destroyItemByItemId(null, Config.CHANGESEX_COIN_ID, 1, 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.sendPacket(new ExShowScreenMessage("Congratulations. Your sex has been changed.", 6000));
- + 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 6 Seconds!");
- + activeChar.broadcastUserInfo();
- + activeChar.decayMe();
- + activeChar.spawnMe();
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + @Override
- + public void run()
- + {
- + activeChar.logout(true);
- + }
- + }, 6000);
- + return;
- + }
- +
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
- Config.java
- +
- ++public static int CHANGESEX_COIN_ID;
- +CHANGESEX_COIN_ID = Integer.parseInt(item.getProperty("ItemSexyCoinID", "5557"));
- Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ItemHandler.java
- _datatable = new TreeMap<>();
- +registerItemHandler(new ChangeSexItem());
- Propriedade voces escolhem onde botar
- +#=============================================================
- +# Item Troca de Sexy
- +#=============================================================
- +#Item Coin Sexy
- +ItemSexyCoinID = 6392
Add Comment
Please, Sign In to add comment