Bluur

Command buff v2

Jan 12th, 2017
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.21 KB | None | 0 0
  1. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  2. ===================================================================
  3. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 1)
  4. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (working copy)
  5. @@ -20,18 +20,29 @@
  6.  
  7.  import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  8. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.BuffCommand;
  9. +import net.sf.l2j.gameserver.datatables.SkillTable;
  10.  
  11. @@ -89,10 +100,218 @@
  12.                
  13.              else if (_command.startsWith("player_help "))
  14.              {
  15.                  playerHelp(activeChar, _command.substring(12));
  16.              }
  17. +            // start voiced .buff command
  18. +            else if (_command.startsWith("buffCommandFight"))
  19. +            {
  20. +                BuffCommand.getFullBuff(activeChar, false);
  21. +            }            
  22. +            else if (_command.startsWith("buffCommandMage"))
  23. +            {
  24. +                BuffCommand.getFullBuff(activeChar, true);
  25. +            }
  26. +            else if (_command.startsWith("buffCommand") && BuffCommand.check(activeChar))
  27. +            {
  28. +                String idBuff = _command.substring(12);
  29. +                int parseIdBuff = Integer.parseInt(idBuff);
  30. +                SkillTable.getInstance().getInfo(parseIdBuff, SkillTable.getInstance().getMaxLevel(parseIdBuff)).getEffects(activeChar, activeChar);
  31. +                BuffCommand.showHtml(activeChar);
  32. +            }
  33. +            else if (_command.startsWith("cancelBuffs") && BuffCommand.check(activeChar))
  34. +            {
  35. +                activeChar.stopAllEffectsExceptThoseThatLastThroughDeath();
  36. +                BuffCommand.showHtml(activeChar);
  37. +            }
  38. +            // end voiced .buff command
  39.  
  40. Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java
  41. ===================================================================
  42. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java    (revision 0)
  43. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java    (working copy)
  44. @@ -0,0 +1,59 @@
  45. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  46. +
  47. +import net.sf.l2j.Config;
  48. +import net.sf.l2j.gameserver.datatables.SkillTable;
  49. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  50. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  51. +import net.sf.l2j.gameserver.model.zone.ZoneId;
  52. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  53. +
  54. +/**
  55. + *
  56. + * @author Bluur
  57. + *
  58. + */
  59. +public class BuffCommand implements IVoicedCommandHandler
  60. +{
  61. +    private final String[] _voicedCommands =
  62. +    {
  63. +        "buff"
  64. +    };
  65. +    
  66. +    @Override
  67. +    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  68. +    {    
  69. +        if (check(activeChar)) //retorna                
  70. +            showHtml(activeChar);    
  71. +        
  72. +        return true;
  73. +    }
  74. +    
  75. +    public static void getFullBuff(L2PcInstance p, boolean isClassMage)
  76. +    {
  77. +        if (check(p))
  78. +        {
  79. +            if (isClassMage)
  80. +            {
  81. +                for (int b : Config.BUFF_COMMAND_MAGE_IDBUFFS)    
  82. +                     SkillTable.getInstance().getInfo(b, SkillTable.getInstance().getMaxLevel(b)).getEffects(p, p);        
  83. +            }
  84. +            else
  85. +            {
  86. +                for (int b : Config.BUFF_COMMAND_FIGHT_IDBUFFS)    
  87. +                     SkillTable.getInstance().getInfo(b, SkillTable.getInstance().getMaxLevel(b)).getEffects(p, p);        
  88. +            }
  89. +            p.sendMessage("[Buff Command]: Voce foi buffado!");
  90. +        }        
  91. +    }
  92. +    
  93. +    public static boolean check(L2PcInstance p)
  94. +    {        
  95. +        return p.isInsideZone(ZoneId.PEACE) && !p.isInCombat() && !p.isInOlympiadMode(); //restrições
  96. +    }
  97. +    
  98. +    public static void showHtml(L2PcInstance player)
  99. +    {      
  100. +        NpcHtmlMessage html = new NpcHtmlMessage(0);    
  101. +        html.setFile("data/html/mods/buffCommand.htm");
  102. +        html.replace("%currentBuffs%", player.getBuffCount());
  103. +        html.replace("%getMaxBuffs%", player.getMaxBuffCount());
  104. +        player.sendPacket(html);
  105. +    }
  106. +    
  107. +    @Override
  108. +    public String[] getVoicedCommandList()
  109. +    {
  110. +        return _voicedCommands;
  111. +    }
  112. +}
  113.  
  114. \ No newline at end of file
  115.  
  116. Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  117. ===================================================================
  118. --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 0)
  119. +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)
  120. @@ -0,0 +1,94 @@
  121.  
  122. import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online;
  123. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.BuffCommand;
  124.  
  125.     protected VoicedCommandHandler()
  126.     {
  127.         registerHandler(new Online());
  128. +       registerHandler(new BuffCommand());
  129.  
  130. Index: java/net/sf/l2j/Config.java
  131. ===================================================================
  132. --- java/net/sf/l2j/Config.java    (revision 1)
  133. +++ java/net/sf/l2j/Config.java    (working copy)
  134. @@ -484,6 +484,11 @@
  135.  
  136.      public static boolean STORE_SKILL_COOLTIME;
  137.      public static int BUFFS_MAX_AMOUNT;
  138.  
  139. +    /** Voiced buff command */
  140. +    public static String LIST_BUFF_COMMAND;
  141. +    public static int[] BUFF_COMMAND_FIGHT_IDBUFFS;
  142. +    public static int[] BUFF_COMMAND_MAGE_IDBUFFS;
  143. +    
  144.  
  145.             STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);                                                            
  146. +                
  147. +            LIST_BUFF_COMMAND = players.getProperty("buffCommandFightBuffsID", "123,456");
  148. +        
  149. +            String[] buffCommand = LIST_BUFF_COMMAND.split(",");            
  150. +            BUFF_COMMAND_FIGHT_IDBUFFS = new int[buffCommand.length];        
  151. +            for (int i = 0; i < buffCommand.length; i++)
  152. +                BUFF_COMMAND_FIGHT_IDBUFFS[i] = Integer.parseInt(buffCommand[i]);
  153. +            
  154. +            LIST_BUFF_COMMAND = players.getProperty("buffCommandMageBuffsID", "789,1011112");
  155. +            
  156. +            buffCommand = LIST_BUFF_COMMAND.split(",");            
  157. +            BUFF_COMMAND_MAGE_IDBUFFS = new int[buffCommand.length];            
  158. +            for (int i = 0; i < buffCommand.length; i++)
  159. +                BUFF_COMMAND_MAGE_IDBUFFS[i] = Integer.parseInt(buffCommand[i]);
  160.  
  161. Index: config/players.properties
  162. ===================================================================
  163. --- config/players.properties    (revision 1)
  164. +++ config/players.properties    (working copy)
  165. @@ -288,4 +288,14 @@
  166.  
  167. StoreSkillCooltime = True
  168. +
  169. +#=============================================================
  170. +#                    Voiced .buff Command   by Bluur
  171. +#=============================================================
  172. +
  173. +# List of ID buffs - FIGHT -
  174. +buffCommandFightBuffsID = 1204,1040,1035,1045,1062,1048,1036,1303,1085,1059,1078,264,267,268,304,349,273,276,365,1363
  175. +
  176. +# List of ID buffs - MAGE -
  177. +buffCommandMageBuffsID = 1204,1068,1040,1035,1036,1045,1086,1077,1240,1242,264,267,268,269,304,364,271,274,275,1363
  178.  
  179. HTM
Advertisement
Add Comment
Please, Sign In to add comment