Bluur

Command Clan Full by name!

Jan 12th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.13 KB | None | 0 0
  1. /*
  2.  * This program is free software: you can redistribute it and/or modify it under
  3.  * the terms of the GNU General Public License as published by the Free Software
  4.  * Foundation, either version 3 of the License, or (at your option) any later
  5.  * version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful, but WITHOUT
  8.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10.  * details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License along with
  13.  * this program. If not, see <http://www.gnu.org/licenses/>.
  14.  */
  15. package net.sf.l2j.gameserver.handler.admincommandhandlers;
  16.  
  17. import net.sf.l2j.gameserver.datatables.ClanTable;
  18. import net.sf.l2j.gameserver.datatables.SkillTable;
  19. import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  20. import net.sf.l2j.gameserver.model.L2Clan;
  21. import net.sf.l2j.gameserver.model.L2Skill;
  22. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  23. import net.sf.l2j.gameserver.network.SystemMessageId;
  24.  
  25. /**
  26.  * @author Bluur
  27.  *
  28.  */
  29. public class AdminClanFullByName implements IAdminCommandHandler
  30. {
  31.     private static final String[] commands = {"admin_clanfull"};
  32.        
  33.     private static final int reputation = 30000000;
  34.     private static final byte level = 8;
  35.    
  36.     //id skills
  37.     private static final int[] clanSkills =
  38.     {
  39.         370,
  40.         371,
  41.         372,
  42.         373,
  43.         374,
  44.         375,
  45.         376,
  46.         377,
  47.         378,
  48.         379,
  49.         380,
  50.         381,
  51.         382,
  52.         383,
  53.         384,
  54.         385,
  55.         386,
  56.         387,
  57.         388,
  58.         389,
  59.         390,
  60.         391
  61.     };
  62.    
  63.     @Override
  64.     public boolean useAdminCommand(String command, L2PcInstance activeChar)
  65.     {
  66.         if (command.startsWith("admin_clanfull"))                                    
  67.             makeClan(command, activeChar);
  68.        
  69.         return true;
  70.     }
  71.    
  72.     private void makeClan(String command, L2PcInstance activeChar)
  73.     {
  74.         try
  75.         {
  76.             String clanName = command.substring(15);
  77.             L2Clan clan = ClanTable.getInstance().getClanByName(clanName);
  78.            
  79.             if (clan == null)
  80.             {
  81.                 activeChar.sendMessage("Clan nao existe ou nome esta incorreto!");
  82.                 return;
  83.             }
  84.        
  85.             for (int s : clanSkills)
  86.             {
  87.                 L2Skill clanSkill = SkillTable.getInstance().getInfo(s, SkillTable.getInstance().getMaxLevel(s));
  88.                 clan.addNewSkill(clanSkill);
  89.             }
  90.            
  91.             clan.addReputationScore(reputation);
  92.             clan.changeLevel(level);
  93.             clan.updateClanInDB();
  94.            
  95.             activeChar.sendMessage("O Clan " + clan.getName() +" esta clanfull agora!");
  96.         }
  97.         catch (IndexOutOfBoundsException e)
  98.         {
  99.             activeChar.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
  100.         }
  101.     }
  102.  
  103.     @Override
  104.     public String[] getAdminCommandList()
  105.     {    
  106.         return commands;
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment