Advertisement
LIONN

Admin Mass Hero

Dec 31st, 2011
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.21 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_DataPack
  3. Index: sql/admin_command_access_rights.sql
  4. ===================================================================
  5. --- sql/admin_command_access_rights.sql (revision 986)
  6. +++ sql/admin_command_access_rights.sql (working copy)
  7. @@ -28,6 +28,7 @@
  8.  ('admin_set_mod','3'),
  9.  ('admin_saveolymp','2'),
  10.  ('admin_manualhero','2'),
  11. +('admin_masshero', '2'),
  12.  
  13.  -- Section: Announcements
  14.  ('admin_list_announcements','3'),
  15. #P L2jFrozen_GameServer
  16. Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  17. ===================================================================
  18. --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java  (revision 986)
  19. +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java  (working copy)
  20. @@ -64,6 +64,7 @@
  21.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMammon;
  22.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminManor;
  23.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMassControl;
  24. +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMassHero;
  25.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMassRecall;
  26.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMenu;
  27.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMobGroup;
  28. @@ -186,6 +187,7 @@
  29.         registerAdminCommandHandler(new AdminAio());
  30.         registerAdminCommandHandler(new AdminCharSupervision());
  31.         registerAdminCommandHandler(new AdminWho()); // L2OFF command
  32. +       registerAdminCommandHandler(new AdminMassHero());
  33.         // ATTENTION: adding new command handlers, you have to change the
  34.         // sql file containing the access levels rights
  35.        
  36. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminMassHero.java
  37. ===================================================================
  38. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminMassHero.java   (revision 0)
  39. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminMassHero.java   (working copy)
  40. @@ -0,0 +1,67 @@
  41. +/*
  42. + * This program is free software; you can redistribute it and/or modify
  43. + * it under the terms of the GNU General Public License as published by
  44. + * the Free Software Foundation; either version 2, or (at your option)
  45. + * any later version.
  46. + *
  47. + * This program is distributed in the hope that it will be useful,
  48. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  49. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  50. + * GNU General Public License for more details.
  51. + *
  52. + * You should have received a copy of the GNU General Public License
  53. + * along with this program; if not, write to the Free Software
  54. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  55. + * 02111-1307, USA.
  56. + *
  57. + * http://www.gnu.org/copyleft/gpl.html
  58. + */
  59. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  60. +
  61. +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  62. +import com.l2jfrozen.gameserver.model.L2World;
  63. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  64. +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
  65. +
  66. +/**
  67. + * @author RedHoT
  68. + */
  69. +public class AdminMassHero implements IAdminCommandHandler
  70. +{
  71. +   private static String[] ADMIN_COMMANDS =
  72. +   {
  73. +       "admin_masshero"
  74. +   };
  75. +   @Override
  76. +   public boolean useAdminCommand(String command, L2PcInstance activeChar)
  77. +   {
  78. +       if (activeChar == null)
  79. +           return false;
  80. +      
  81. +       if (command.startsWith("admin_masshero"))
  82. +       {
  83. +           for (L2PcInstance player : L2World.getInstance().getAllPlayers())
  84. +           {
  85. +               if (player == null)
  86. +                   return false;
  87. +              
  88. +               /* Check to see if the player already is Hero and if aren't in Olympiad Mode */
  89. +               if (!player.isHero() || !player.isInOlympiadMode())
  90. +               {
  91. +                   player.setHero(true);
  92. +                   player.sendMessage("Admin is rewarding all online players with Hero Status.");
  93. +                   player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
  94. +                   player.broadcastUserInfo();
  95. +               }
  96. +               player = null;
  97. +           }
  98. +       }
  99. +       return true;
  100. +   }
  101. +
  102. +   @Override
  103. +   public String[] getAdminCommandList()
  104. +   {
  105. +       return ADMIN_COMMANDS;
  106. +   }
  107. +}
  108. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement