Advertisement
Guest User

Grand Boss Teleport..

a guest
Oct 27th, 2010
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.28 KB | None | 0 0
  1. Index: config/l2jmods.properties
  2. ===================================================================
  3. --- config/l2jmods.properties   (revision 4422)
  4. +++ config/l2jmods.properties   (working copy)
  5. @@ -91,6 +91,40 @@
  6.  #Cost of Divorce, % of Adena
  7.  WeddingDivorceCosts=20
  8.  
  9. +# ------------------------------
  10. +# Teleport Commands
  11. +# ------------------------------
  12. +# Allow Players teleport to Grand Bosses with commands:
  13. +#.queenant .core .orfen .baium .zaken .antharas .valakas
  14. +# Default: False
  15. +AllowTeleport = False
  16. +
  17. +# Item Needed to Teleport.
  18. +# Default: 57
  19. +TeleportItem = 57
  20. +
  21. +# Amount of Needed items.
  22. +# Default: 1000
  23. +TeleportAmount = 1000
  24. +
  25.  #---------------------------------------------------------------
  26.  # Team vs. Team Event Engine (by FBIagent)                     -
  27.  #---------------------------------------------------------------
  28. Index: net/sf/l2j/Config.java
  29. ===================================================================
  30. --- net/sf/l2j/Config.java  (revision 4422)
  31. +++ net/sf/l2j/Config.java  (working copy)
  32. @@ -882,6 +882,16 @@
  33.      public static boolean L2JMOD_WEDDING_FORMALWEAR;
  34.      public static int L2JMOD_WEDDING_DIVORCE_COSTS;
  35.  
  36. +       public static boolean TELEPORT_BOSSES;
  37. +   public static int TELEPORT_ITEM;
  38. +   public static int TELEPORT_AMOUNT;
  39. +
  40.      // Packet information
  41.      /** Count the amount of packets per minute ? */
  42.      public static boolean  COUNT_PACKETS           = false;
  43. @@ -1859,6 +1869,19 @@
  44.                  L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
  45.                  L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
  46.  
  47. +                               TELEPORT_BOSSES = Boolean.parseBoolean(L2JModSettings.getProperty("AllowTeleport", "False"));
  48. +               TELEPORT_ITEM = Integer.parseInt(L2JModSettings.getProperty("TeleportItem", "57"));
  49. +               TELEPORT_AMOUNT = Integer.parseInt(L2JModSettings.getProperty("TeleportAmount", "1000"));
  50. +               if (TELEPORT_AMOUNT < 1)
  51. +               {
  52. +                   TELEPORT_AMOUNT = 1;
  53. +               }
  54. +
  55.                  if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
  56.                  {
  57.                      TVT_EVENT_ENABLED = false;
  58. Index: net/sf/l2j/gameserver/GameServer.java
  59. ===================================================================
  60. --- net/sf/l2j/gameserver/GameServer.java   (revision 4422)
  61. +++ net/sf/l2j/gameserver/GameServer.java   (working copy)
  62. @@ -198,6 +198,7 @@
  63.  import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
  64.  import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
  65.  import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
  66. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Teleport;
  67.  import net.sf.l2j.gameserver.idfactory.IdFactory;
  68.  import net.sf.l2j.gameserver.instancemanager.AuctionManager;
  69.  import net.sf.l2j.gameserver.instancemanager.BoatManager;
  70. @@ -595,11 +596,13 @@
  71.  
  72.         _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
  73.  
  74.         if(Config.L2JMOD_ALLOW_WEDDING)
  75.             CoupleManager.getInstance();
  76.  
  77. +       if (Config.TELEPORT_BOSSES)        
  78. +           _voicedCommandHandler.registerVoicedCommandHandler(new Teleport());
  79. +      
  80.          TaskManager.getInstance();
  81.  
  82.         GmListTable.getInstance();
  83. Index: net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java
  84. ===================================================================
  85. --- net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java   (revision 0)
  86. +++ net/sf/l2j/gameserver/handler/voicedcommandhandlers/Teleport.java   (revision 0)
  87. @@ -0,0 +1,176 @@
  88. +/*
  89. + * This program is free software: you can redistribute it and/or modify it under
  90. + * the terms of the GNU General Public License as published by the Free Software
  91. + * Foundation, either version 3 of the License, or (at your option) any later
  92. + * version.
  93. + *
  94. + * This program is distributed in the hope that it will be useful, but WITHOUT
  95. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  96. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  97. + * details.
  98. + *
  99. + * You should have received a copy of the GNU General Public License along with
  100. + * this program. If not, see <http://www.gnu.org/licenses/>.
  101. + */
  102. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  103. +
  104. +import net.sf.l2j.Config;
  105. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  106. +import net.sf.l2j.gameserver.instancemanager.CastleManager;
  107. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  108. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  109. +import net.sf.l2j.gameserver.serverpackets.ActionFailed;
  110. +import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;
  111. +/**
  112. + * @author Gore.
  113. + *
  114. + */
  115. +public class Teleport implements IVoicedCommandHandler
  116. +{
  117. +   private static final String[] VOICED_COMMANDS =
  118. +   {
  119. +       "queenant",
  120. +       "core",
  121. +       "orfen",
  122. +       "baium",
  123. +       "zaken",
  124. +       "antharas",
  125. +       "valakas"
  126. +   };
  127. +  
  128. +   private boolean check(L2PcInstance activeChar)
  129. +       {
  130. +           if (!Config.TELEPORT_BOSSES)
  131. +           {
  132. +               activeChar.sendMessage ("Command Disabled.");
  133. +               return false;
  134. +           }
  135. +
  136. +           else if (activeChar.getPvpFlag() != 0)
  137. +           {
  138. +               activeChar.sendMessage("You are in Combat!");
  139. +               return false;
  140. +           }
  141. +
  142. +           else if(activeChar.isInJail())
  143. +           {
  144. +               activeChar.sendMessage("You are in Jail!");
  145. +               return false;
  146. +           }
  147. +           else if(activeChar.isInOlympiadMode())
  148. +           {
  149. +               activeChar.sendMessage("You are in the Olympiad now.");
  150. +               return false;
  151. +           }
  152. +           else if(activeChar.atEvent)
  153. +           {
  154. +               activeChar.sendMessage("You are in an event.");
  155. +               return false;
  156. +           }
  157. +           else  if (activeChar.isInDuel())
  158. +           {
  159. +               activeChar.sendMessage("You are in a duel!");
  160. +               return false;
  161. +           }
  162. +           else if (activeChar.inObserverMode())
  163. +           {
  164. +               activeChar.sendMessage("You are in the observation.");
  165. +               return false;
  166. +           }
  167. +           else if(activeChar.getClan() != null
  168. +                   && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null
  169. +                   && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress())
  170. +           {
  171. +               activeChar.sendMessage("You are in siege.");
  172. +               return false;
  173. +           }
  174. +           else if (activeChar.isFestivalParticipant())
  175. +           {
  176. +               activeChar.sendMessage("You are in a festival.");
  177. +               return false;
  178. +           }
  179. +           else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
  180. +           {
  181. +               activeChar.sendMessage("You are in the dimensional rift.");
  182. +               return false;
  183. +           }
  184. +
  185. +           else if (!TvTEvent.onEscapeUse(activeChar.getName()))
  186. +           {
  187. +               activeChar.sendPacket(new ActionFailed());
  188. +               return false;
  189. +           }
  190. +          
  191. +           else if (activeChar.getKarma() > 0 )   
  192. +           {
  193. +               activeChar.sendMessage("You have Karma");
  194. +               return false;
  195. +           }
  196. +                                  
  197. +           return true;
  198. +       }
  199. +      
  200. +       private void tele(L2PcInstance activeChar, int x, int y, int z, String name)
  201. +
  202. +       {
  203. +      
  204. +           activeChar.teleToLocation(x, y, z);
  205. +           activeChar.sendMessage("You have been teleported to "+name+".");
  206. +       }
  207. +      
  208. +      
  209. +   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  210. +   {
  211. +
  212. +       if (activeChar.getInventory().getInventoryItemCount(Config.TELEPORT_ITEM, 0) >= Config.TELEPORT_AMOUNT)
  213. +      
  214. +       {
  215. +           InventoryUpdate iu = new InventoryUpdate();
  216. +           activeChar.getInventory().destroyItemByItemId("Teleport", Config.TELEPORT_ITEM, Config.TELEPORT_AMOUNT, activeChar, null);
  217. +           activeChar.getInventory().updateDatabase();
  218. +           activeChar.sendPacket(iu);
  219. +       }
  220. +       else
  221. +       {
  222. +           activeChar.sendMessage("You do not have enough items, you need " + Config.TELEPORT_AMOUNT + " of the required items.");
  223. +        return false;
  224. +       }
  225. +  
  226. +
  227. +       if (command.equalsIgnoreCase("queenant") && Config.TELEPORT_BOSSES && check(activeChar))
  228. +       {
  229. +               tele(activeChar,-21228,184446,-5722,"Queen Ant");              
  230. +       }
  231. +      
  232. +       if (command.equalsIgnoreCase("core") && Config.TELEPORT_BOSSES && check(activeChar))
  233. +       {
  234. +               tele(activeChar,16471,109031,-6488,"Core");            
  235. +       }
  236. +       if (command.equalsIgnoreCase("orfen") && Config.TELEPORT_BOSSES && check(activeChar))
  237. +       {
  238. +               tele(activeChar,54067,17778,-5489,"Orfen");            
  239. +       }
  240. +       if (command.equalsIgnoreCase("baium") && Config.TELEPORT_BOSSES && check(activeChar))
  241. +       {
  242. +               tele(activeChar,112933,15181,10077,"Baium");               
  243. +       }
  244. +       if (command.equalsIgnoreCase("zaken") && Config.TELEPORT_BOSSES && check(activeChar))
  245. +       {
  246. +               tele(activeChar,54862,218697,-3225,"Zaken");               
  247. +       }
  248. +       if (command.equalsIgnoreCase("antharas") && Config.TELEPORT_BOSSES && check(activeChar))
  249. +       {
  250. +               tele(activeChar,180822,114481,-7665,"Antharas");               
  251. +       }
  252. +       if (command.equalsIgnoreCase("valakas") && Config.TELEPORT_BOSSES && check(activeChar))
  253. +       {
  254. +               tele(activeChar,214914,-117074,-1636,"Valakas");               
  255. +       }
  256. +       return true;
  257. +   }
  258. +
  259. +   public String[] getVoicedCommandList()
  260. +   {
  261. +       return VOICED_COMMANDS;
  262. +   }
  263. +}
  264. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement