andreivoinea93

Untitled

May 22nd, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  2.  
  3. import net.sf.l2j.Config;
  4. import net.sf.l2j.gameserver.GameTimeController;
  5. import net.sf.l2j.gameserver.ThreadPoolManager;
  6. import net.sf.l2j.gameserver.datatables.MapRegionTable;
  7. import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  8. import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding.EscapeFinalizer;
  9. import net.sf.l2j.gameserver.instancemanager.CastleManager;
  10. import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
  11. import net.sf.l2j.gameserver.model.L2World;
  12. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  13. import net.sf.l2j.gameserver.serverpackets.SystemMessage;
  14.  
  15. /**
  16. *
  17. *
  18. */
  19. public class Cl implements IVoicedCommandHandler
  20. {
  21. private static final String[] VOICED_COMMANDS = { "cl" };
  22.  
  23. public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  24. {
  25.  
  26. if (command.equalsIgnoreCase("cl"))
  27. {
  28.  
  29. if (activeChar.getClan() == null)
  30. {
  31. return false;
  32. }
  33.  
  34. L2PcInstance leader;
  35. leader = (L2PcInstance)L2World.getInstance().findObject(activeChar.getClan().getLeaderId());
  36.  
  37. if(leader == null)
  38. {
  39. activeChar.sendMessage("Your partner is not online.");
  40. return false;
  41. }
  42. else if(leader.isInJail())
  43. {
  44. activeChar.sendMessage("Your leader is in Jail.");
  45. return false;
  46. }
  47. else if(leader.isInOlympiadMode())
  48. {
  49. activeChar.sendMessage("Your leader is in the Olympiad now.");
  50. return false;
  51. }
  52. else if(leader.atEvent)
  53. {
  54. activeChar.sendMessage("Your leader is in an event.");
  55. return false;
  56. }
  57. else if (leader.isInDuel())
  58. {
  59. activeChar.sendMessage("Your leader is in a duel.");
  60. return false;
  61. }
  62. else if (leader.isFestivalParticipant())
  63. {
  64. activeChar.sendMessage("Your leader is in a festival.");
  65. return false;
  66. }
  67. else if (leader.isInParty() && leader.getParty().isInDimensionalRift())
  68. {
  69. activeChar.sendMessage("Your leader is in dimensional rift.");
  70. return false;
  71. }
  72. else if (leader.inObserverMode())
  73. {
  74. activeChar.sendMessage("Your leader is in the observation.");
  75. }
  76. else if(leader.getClan() != null
  77. && CastleManager.getInstance().getCastleByOwner(leader.getClan()) != null
  78. && CastleManager.getInstance().getCastleByOwner(leader.getClan()).getSiege().getIsInProgress())
  79. {
  80. activeChar.sendMessage("Your leader is in siege, you can't go to your leader.");
  81. return false;
  82. }
  83.  
  84. else if(activeChar.isInJail())
  85. {
  86. activeChar.sendMessage("You are in Jail!");
  87. return false;
  88. }
  89. else if(activeChar.isInOlympiadMode())
  90. {
  91. activeChar.sendMessage("You are in the Olympiad now.");
  92. return false;
  93. }
  94. else if(activeChar._inEventVIP)
  95. {
  96. activeChar.sendPacket(SystemMessage.sendString("Your leader is in a VIP event."));
  97. return false;
  98. }
  99. else if(activeChar.atEvent)
  100. {
  101. activeChar.sendMessage("You are in an event.");
  102. return false;
  103. }
  104. else if (activeChar.isInDuel())
  105. {
  106. activeChar.sendMessage("You are in a duel!");
  107. return false;
  108. }
  109. else if (activeChar.inObserverMode())
  110. {
  111. activeChar.sendMessage("You are in the observation.");
  112. }
  113. else if(activeChar.getClan() != null
  114. && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null
  115. && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress())
  116. {
  117. activeChar.sendMessage("You are in siege, you can't go to your leader.");
  118. return false;
  119. }
  120. else if (activeChar.isFestivalParticipant())
  121. {
  122. activeChar.sendMessage("You are in a festival.");
  123. return false;
  124. }
  125. else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
  126. {
  127. activeChar.sendMessage("You are in the dimensional rift.");
  128. return false;
  129. }
  130. else if (activeChar == leader)
  131. {
  132. activeChar.sendMessage("You cannot teleport to yourself.");
  133. return false;
  134. }
  135. if(activeChar.getInventory().getItemByItemId(3470) == null)
  136. {
  137. activeChar.sendMessage("You need one or more Gold Bars to use the cl-teleport system.");
  138. return false;
  139. }
  140. int leaderx;
  141. int leadery;
  142. int leaderz;
  143.  
  144. leaderx = leader.getX();
  145. leadery = leader.getY();
  146. leaderz = leader.getZ();
  147.  
  148. activeChar.teleToLocation(leaderx, leadery, leaderz);
  149. activeChar.sendMessage("You have been teleported to your leader!");
  150. activeChar.getInventory().destroyItemByItemId("RessSystem", 3470, 1, activeChar, activeChar.getTarget());
  151. activeChar.sendMessage("One GoldBar has dissapeared! Thank you!");
  152. }
  153. return true;
  154. }
  155. public String[] getVoicedCommandList()
  156. {
  157. return VOICED_COMMANDS;
  158. }
  159.  
  160. }
Advertisement
Add Comment
Please, Sign In to add comment