Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: config/l2jmods.properties
- ===================================================================
- --- config/l2jmods.properties (revision 4422)
- +++ config/l2jmods.properties (working copy)
- @@ -91,6 +91,40 @@
- #Cost of Divorce, % of Adena
- WeddingDivorceCosts=20
- +# ------------------------------
- +# Teleport Commands
- +# ------------------------------
- +# Allow Players teleport to Grand Bosses with commands:
- +#.queenant .core .orfen .baium .zaken .antharas .valakas
- +# Default: False
- +AllowTeleport = False
- +
- +# Item Needed to Teleport.
- +# Default: 57
- +TeleportItem = 57
- +
- +# Amount of Needed items.
- +# Default: 1000
- +TeleportAmount = 1000
- +
- #---------------------------------------------------------------
- # Team vs. Team Event Engine (by FBIagent) -
- #---------------------------------------------------------------
- Index: net/sf/l2j/Config.java
- ===================================================================
- --- net/sf/l2j/Config.java (revision 4422)
- +++ net/sf/l2j/Config.java (working copy)
- @@ -882,6 +882,16 @@
- public static boolean L2JMOD_WEDDING_FORMALWEAR;
- public static int L2JMOD_WEDDING_DIVORCE_COSTS;
- + public static boolean TELEPORT_BOSSES;
- + public static int TELEPORT_ITEM;
- + public static int TELEPORT_AMOUNT;
- +
- // Packet information
- /** Count the amount of packets per minute ? */
- public static boolean COUNT_PACKETS = false;
- @@ -1859,6 +1869,19 @@
- L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
- L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
- + TELEPORT_BOSSES = Boolean.parseBoolean(L2JModSettings.getProperty("AllowTeleport", "False"));
- + TELEPORT_ITEM = Integer.parseInt(L2JModSettings.getProperty("TeleportItem", "57"));
- + TELEPORT_AMOUNT = Integer.parseInt(L2JModSettings.getProperty("TeleportAmount", "1000"));
- + if (TELEPORT_AMOUNT < 1)
- + {
- + TELEPORT_AMOUNT = 1;
- + }
- +
- if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
- {
- TVT_EVENT_ENABLED = false;
- Index: net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- net/sf/l2j/gameserver/GameServer.java (revision 4422)
- +++ net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -198,6 +198,7 @@
- import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Teleport;
- import net.sf.l2j.gameserver.idfactory.IdFactory;
- import net.sf.l2j.gameserver.instancemanager.AuctionManager;
- import net.sf.l2j.gameserver.instancemanager.BoatManager;
- @@ -595,11 +596,13 @@
- _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
- if(Config.L2JMOD_ALLOW_WEDDING)
- CoupleManager.getInstance();
- + if (Config.TELEPORT_BOSSES)
- + _voicedCommandHandler.registerVoicedCommandHandler(new Teleport());
- +
- TaskManager.getInstance();
- GmListTable.getInstance();
- Index: net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java
- ===================================================================
- --- net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java (revision 0)
- +++ net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java (revision 0)
- @@ -0,0 +1,176 @@
- +/*
- + * 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.instancemanager.CastleManager;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;
- +/**
- + * @author Gore.
- + *
- + */
- +public class Teleport implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "queenant",
- + "core",
- + "orfen",
- + "baium",
- + "zaken",
- + "antharas",
- + "valakas"
- + };
- +
- + private boolean check(L2PcInstance activeChar)
- + {
- + if (!Config.TELEPORT_BOSSES)
- + {
- + activeChar.sendMessage ("Command Disabled.");
- + return false;
- + }
- +
- + else if (activeChar.getPvpFlag() != 0)
- + {
- + activeChar.sendMessage("You are in Combat!");
- + return false;
- + }
- +
- + else if(activeChar.isInJail())
- + {
- + activeChar.sendMessage("You are in Jail!");
- + return false;
- + }
- + else if(activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("You are in the Olympiad now.");
- + return false;
- + }
- + else if(activeChar.atEvent)
- + {
- + activeChar.sendMessage("You are in an event.");
- + return false;
- + }
- + else if (activeChar.isInDuel())
- + {
- + activeChar.sendMessage("You are in a duel!");
- + return false;
- + }
- + else if (activeChar.inObserverMode())
- + {
- + activeChar.sendMessage("You are in the observation.");
- + return false;
- + }
- + else if(activeChar.getClan() != null
- + && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null
- + && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress())
- + {
- + activeChar.sendMessage("You are in siege.");
- + return false;
- + }
- + else if (activeChar.isFestivalParticipant())
- + {
- + activeChar.sendMessage("You are in a festival.");
- + return false;
- + }
- + else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
- + {
- + activeChar.sendMessage("You are in the dimensional rift.");
- + return false;
- + }
- +
- + else if (!TvTEvent.onEscapeUse(activeChar.getName()))
- + {
- + activeChar.sendPacket(new ActionFailed());
- + return false;
- + }
- +
- + else if (activeChar.getKarma() > 0 )
- + {
- + activeChar.sendMessage("You have Karma");
- + return false;
- + }
- +
- + return true;
- + }
- +
- + private void tele(L2PcInstance activeChar, int x, int y, int z, String name)
- +
- + {
- +
- + activeChar.teleToLocation(x, y, z);
- + activeChar.sendMessage("You have been teleported to "+name+".");
- + }
- +
- +
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
- + {
- +
- + if (activeChar.getInventory().getInventoryItemCount(Config.TELEPORT_ITEM, 0) >= Config.TELEPORT_AMOUNT)
- +
- + {
- + InventoryUpdate iu = new InventoryUpdate();
- + activeChar.getInventory().destroyItemByItemId("Teleport", Config.TELEPORT_ITEM, Config.TELEPORT_AMOUNT, activeChar, null);
- + activeChar.getInventory().updateDatabase();
- + activeChar.sendPacket(iu);
- + }
- + else
- + {
- + activeChar.sendMessage("You do not have enough items, you need " + Config.TELEPORT_AMOUNT + " of the required items.");
- + return false;
- + }
- +
- +
- + if (command.equalsIgnoreCase("queenant") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,-21228,184446,-5722,"Queen Ant");
- + }
- +
- + if (command.equalsIgnoreCase("core") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,16471,109031,-6488,"Core");
- + }
- + if (command.equalsIgnoreCase("orfen") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,54067,17778,-5489,"Orfen");
- + }
- + if (command.equalsIgnoreCase("baium") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,112933,15181,10077,"Baium");
- + }
- + if (command.equalsIgnoreCase("zaken") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,54862,218697,-3225,"Zaken");
- + }
- + if (command.equalsIgnoreCase("antharas") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,180822,114481,-7665,"Antharas");
- + }
- + if (command.equalsIgnoreCase("valakas") && Config.TELEPORT_BOSSES && check(activeChar))
- + {
- + tele(activeChar,214914,-117074,-1636,"Valakas");
- + }
- + return true;
- + }
- +
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement