Advertisement
warc222

adminrecallall2

Jan 27th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.96 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminRecallAll.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminRecallAll.java (revision 0)
  6. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminRecallAll.java (revision 0)
  7. @@ -0,0 +1,111 @@
  8. +/* This program is free software; you can redistribute it and/or modify
  9. + * it under the terms of the GNU General Public License as published by
  10. + * the Free Software Foundation; either version 2, or (at your option)
  11. + * any later version.
  12. + *
  13. + * This program is distributed in the hope that it will be useful,
  14. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. + * GNU General Public License for more details.
  17. + *
  18. + * You should have received a copy of the GNU General Public License
  19. + * along with this program; if not, write to the Free Software
  20. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  21. + * 02111-1307, USA.
  22. + *
  23. + * http://www.gnu.org/copyleft/gpl.html
  24. + */
  25. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  26. +
  27. +import com.l2jfrozen.Config;
  28. +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  29. +import com.l2jfrozen.gameserver.managers.GrandBossManager;
  30. +import com.l2jfrozen.gameserver.model.L2Character;
  31. +import com.l2jfrozen.gameserver.model.L2World;
  32. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  33. +import com.l2jfrozen.gameserver.network.SystemMessageId;
  34. +import com.l2jfrozen.gameserver.network.serverpackets.ConfirmDlg;
  35. +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  36. +import com.l2jfrozen.gameserver.util.Util;
  37. +
  38. +
  39. +
  40. +public class AdminRecallAll implements IAdminCommandHandler
  41. +{
  42. + private static final String[] ADMIN_COMMANDS = { "admin_recallall" };
  43. + public static boolean isAdminSummoning = false;
  44. + public static int x = 0;
  45. + public static int y = 0;
  46. + public static int z = 0;
  47. +
  48. +
  49. + public boolean useAdminCommand(String command, L2PcInstance activeChar)
  50. + {
  51. + if (command.startsWith("admin_recallall"))
  52. + {
  53. + x = activeChar.getX();
  54. + y = activeChar.getY();
  55. + z = activeChar.getZ();
  56. + isAdminSummoning = true;
  57. +
  58. +
  59. + for(L2PcInstance player : L2World.getInstance().getAllPlayers())
  60. + {
  61. + try
  62. + {
  63. + if (!L2PcInstance.checkSummonTargetStatus(player, activeChar)
  64. + || player.isAlikeDead()
  65. + || player._inEvent
  66. + || player._inEventCTF
  67. + || player._inEventDM
  68. + || player._inEventTvT
  69. + || player._inEventVIP
  70. + || player.isInStoreMode()
  71. + || player.isRooted() || player.isInCombat()
  72. + || (GrandBossManager.getInstance().getZone(player) != null && !player.isGM())
  73. + || player.isInOlympiadMode()
  74. + || player.isFestivalParticipant()
  75. + || player.isInsideZone(L2Character.ZONE_PVP)
  76. + )
  77. + continue;
  78. +
  79. + if(!Util.checkIfInRange(0, activeChar, player, false))
  80. + {
  81. + ThreadPoolManager.getInstance().scheduleGeneral(new Restore(), 15000);
  82. + ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.S1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
  83. + confirm.addString(activeChar.getName());
  84. + confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
  85. + confirm.addTime(15000);
  86. + confirm.addRequesterId(activeChar.getObjectId());
  87. + player.sendPacket(confirm);
  88. + }
  89. + player = null;
  90. + }
  91. + catch(Throwable e)
  92. + {
  93. + if(Config.ENABLE_ALL_EXCEPTIONS)
  94. + e.printStackTrace();
  95. + }
  96. + }
  97. +
  98. + }
  99. + return false;
  100. +
  101. + }
  102. +
  103. + class Restore implements Runnable
  104. + {
  105. + public void run()
  106. + {
  107. + x = 0;
  108. + y = 0;
  109. + z = 0;
  110. + isAdminSummoning = false;
  111. + }
  112. +
  113. + }
  114. + public String[] getAdminCommandList()
  115. + {
  116. + return ADMIN_COMMANDS;
  117. + }
  118. +}
  119. \ No newline at end of file
  120. Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/DlgAnswer.java
  121. ===================================================================
  122. --- head-src/com/l2jfrozen/gameserver/network/clientpackets/DlgAnswer.java (revision 921)
  123. +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/DlgAnswer.java (working copy)
  124. @@ -19,7 +19,9 @@
  125. import com.l2jfrozen.Config;
  126. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  127. import com.l2jfrozen.gameserver.network.SystemMessageId;
  128. +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRecallAll;
  129.  
  130. +
  131. /**
  132. * @author Dezmond_snz - Packet Format: cddd
  133. */
  134. @@ -50,7 +52,17 @@
  135. activeChar.reviveAnswer(_answer);
  136.  
  137. else if (_messageId==SystemMessageId.S1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
  138. - activeChar.teleportAnswer(_answer, _requestId);
  139. + {
  140. + if(AdminRecallAll.isAdminSummoning == true && _answer==1)
  141. + {
  142. + activeChar.teleToLocation(AdminRecallAll.x, AdminRecallAll.y, AdminRecallAll.z, false);
  143. + }
  144. + else
  145. + {
  146. + activeChar.teleportAnswer(_answer, _requestId);
  147. + }
  148. +
  149. + }
  150.  
  151. else if (_messageId == 614 && Config.L2JMOD_ALLOW_WEDDING)
  152. activeChar.EngageAnswer(_answer);
  153. \ No newline at end of file
  154. Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  155. ===================================================================
  156. --- gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 909)
  157. +++ gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)
  158. @@ -74,11 +75,13 @@
  159. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPledge;
  160. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPolymorph;
  161. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminQuest;
  162. +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRecallAll;
  163. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminReload;
  164. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRepairChar;
  165. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRes;
  166. @@ -131,6 +134,7 @@
  167. registerAdminCommandHandler(new AdminCreateItem());
  168. registerAdminCommandHandler(new AdminHeal());
  169. registerAdminCommandHandler(new AdminHelpPage());
  170. + registerAdminCommandHandler(new AdminRecallAll());
  171. registerAdminCommandHandler(new AdminShutdown());
  172. registerAdminCommandHandler(new AdminSpawn());
  173. registerAdminCommandHandler(new AdminSkill());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement