Bluur

Menu configure settings

Jan 12th, 2017
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.18 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java
  3. ===================================================================
  4. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java    (revision 0)
  5. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java    (working copy)
  6. @@ -0,0 +1,100 @@
  7. +/*
  8. + * This program is free software: you can redistribute it and/or modify it under
  9. + * the terms of the GNU General Public License as published by the Free Software
  10. + * Foundation, either version 3 of the License, or (at your option) any later
  11. + * version.
  12. + *
  13. + * This program is distributed in the hope that it will be useful, but WITHOUT
  14. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16. + * details.
  17. + *
  18. + * You should have received a copy of the GNU General Public License along with
  19. + * this program. If not, see <http://www.gnu.org/licenses/>.
  20. + */
  21. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  22. +
  23. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  24. +import net.sf.l2j.gameserver.model.L2World;
  25. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  26. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  27. +
  28. +/**
  29. + *
  30. + * @author Bluur
  31. + * @version 1.0
  32. + */
  33. +
  34. +public class Menu implements IVoicedCommandHandler
  35. +{
  36. +    private static final String[] _voicedCommands =
  37. +    {
  38. +        "menu",
  39. +        "setPartyRefuse",
  40. +        "setTradeRefuse",    
  41. +        "setbuffsRefuse",
  42. +        "setMessageRefuse",
  43. +    };
  44. +    
  45. +    private static final String ACTIVED = "<font color=00FF00>ON</font>";
  46. +    private static final String DESATIVED = "<font color=FF0000>OFF</font>";
  47. +    
  48. +    @Override
  49. +    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  50. +    {
  51. +        if (command.equals("menu"))
  52. +            showHtml(activeChar);        
  53. +                
  54. +        else if (command.equals("setPartyRefuse"))
  55. +        {
  56. +            if (activeChar.isPartyInRefuse())
  57. +                activeChar.setIsPartyInRefuse(false);
  58. +            else
  59. +                activeChar.setIsPartyInRefuse(true);            
  60. +            showHtml(activeChar);
  61. +        }    
  62. +        else if (command.equals("setTradeRefuse"))
  63. +        {
  64. +            if (activeChar.getTradeRefusal())
  65. +                activeChar.setTradeRefusal(false);
  66. +            else
  67. +                activeChar.setTradeRefusal(true);
  68. +            showHtml(activeChar);
  69. +        }        
  70. +        else if (command.equals("setMessageRefuse"))
  71. +        {        
  72. +            if (activeChar.isInRefusalMode())
  73. +                activeChar.setInRefusalMode(false);
  74. +            else
  75. +                activeChar.setInRefusalMode(true);
  76. +            showHtml(activeChar);
  77. +        }
  78. +        else if (command.equals("setbuffsRefuse"))
  79. +        {        
  80. +            if (activeChar.isBuffProtected())
  81. +                activeChar.setIsBuffProtected(false);
  82. +            else
  83. +                activeChar.setIsBuffProtected(true);
  84. +            showHtml(activeChar);
  85. +        }
  86. +        return true;
  87. +    }
  88. +    
  89. +    private static void showHtml(L2PcInstance activeChar)
  90. +    {
  91. +        NpcHtmlMessage html = new NpcHtmlMessage(0);
  92. +        html.setFile("data/html/mods/menu.htm");
  93. +        html.replace("%online%", L2World.getInstance().getAllPlayersCount());    
  94. +        html.replace("%partyRefusal%", activeChar.isPartyInRefuse() ? ACTIVED : DESATIVED);
  95. +        html.replace("%tradeRefusal%", activeChar.getTradeRefusal() ? ACTIVED : DESATIVED);
  96. +        html.replace("%buffsRefusal%", activeChar.isBuffProtected() ? ACTIVED : DESATIVED);
  97. +        html.replace("%messageRefusal%", activeChar.isInRefusalMode() ? ACTIVED : DESATIVED);    
  98. +        activeChar.sendPacket(html);
  99. +    }
  100. +    
  101. +    @Override
  102. +    public String[] getVoicedCommandList()
  103. +    {
  104. +        return _voicedCommands;
  105. +    }
  106. +}
  107. \ No newline at end of file
  108. Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  109. ===================================================================
  110. --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 0)
  111. +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)
  112.  
  113. import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online;
  114. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Menu;
  115.  
  116.         registerHandler(new Online());
  117. +        registerHandler(new Menu());
  118.  
  119. Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
  120. ===================================================================
  121. --- java/net/sf/l2j/gameserver/model/actor/L2Character.java    (revision 1)
  122. +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java    (working copy)
  123. @@ -182,6 +184,18 @@
  124.      
  125.      private boolean _isRaid = false;
  126.      
  127. +    // protect From Debuffs
  128. +    private boolean _isBuffProtected = false;
  129. +    public void setIsBuffProtected(boolean value)
  130. +    {
  131. +        _isBuffProtected = value;
  132. +    }
  133. +            
  134. +    public boolean isBuffProtected()
  135. +    {
  136. +        return _isBuffProtected;    
  137. +    }
  138.  
  139. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java
  140. ===================================================================
  141. --- java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java    (revision 1)
  142. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java    (working copy)
  143. @@ -89,6 +89,15 @@
  144.                      if (target.getFirstEffect(L2EffectType.BLOCK_BUFF) != null)
  145.                          continue;
  146.                      
  147. +                    // Anti-Buff Protection prevents you from getting buffs by other players
  148. +                    if (activeChar instanceof L2PcInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
  149. +                        && (skill.getSkillType() == L2SkillType.BUFF                        
  150. +                        || skill.getSkillType() == L2SkillType.HEAL_PERCENT
  151. +                        || skill.getSkillType() == L2SkillType.MANAHEAL_PERCENT
  152. +                        || skill.getSkillType() == L2SkillType.COMBATPOINTHEAL
  153. +                        || skill.getSkillType() == L2SkillType.REFLECT))
  154. +                    continue;
  155. +                    
  156. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  157. ===================================================================
  158. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1)
  159. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  160. @@ -541,6 +541,7 @@
  161.      private boolean _messageRefusal = false; // message refusal mode
  162.      private boolean _tradeRefusal = false; // Trade refusal
  163.      private boolean _exchangeRefusal = false; // Exchange refusal
  164. +    private boolean _isPartyInRefuse = false; // Party Refusal Mode
  165.      
  166. @@ -7979,6 +7997,16 @@
  167.          return _race[i];
  168.      }
  169.      
  170. +    public boolean isPartyInRefuse()
  171. +    {
  172. +        return _isPartyInRefuse;
  173. +    }
  174. +
  175. +    public void setIsPartyInRefuse(boolean value)
  176. +    {
  177. +        _isPartyInRefuse = value;
  178. +    }
  179. +    
  180.      public boolean isInRefusalMode()
  181.      {
  182. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
  183. ===================================================================
  184. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (revision 1)
  185. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (working copy)
  186. @@ -64,6 +72,18 @@
  187.              return;
  188.          }
  189.          
  190. +        if (target.isPartyInRefuse())
  191. +        {
  192. +            requestor.sendMessage("[Party Refuse]: Player in refusal party.");
  193. +            return;
  194. +        }
  195. +        
  196.          if (target.isInParty())
  197.  
  198. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  199. ===================================================================
  200. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 1)
  201. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (working copy)
  202.  
  203. +            if (_command.startsWith("voiced_"))
  204. +            {
  205. +                String command = _command.split(" ")[0];
  206. +
  207. +                IVoicedCommandHandler ach = VoicedCommandHandler.getInstance().getHandler(_command.substring(7));
  208. +
  209. +                if (ach == null)
  210. +                {
  211. +                    activeChar.sendMessage("The command " + command.substring(7) + " does not exist!");
  212. +                    _log.warning("No handler registered for command '" + _command + "'");
  213. +                    return;
  214. +                }
  215. +
  216. +                ach.useVoicedCommand(_command.substring(7), activeChar, null);
  217. +            }            
  218.              else if (_command.startsWith("npc_"))
  219.              {
  220.                  if (!activeChar.validateBypass(_command))
  221.  
  222. data/html/mods/
  223.  
  224. menu.htm
  225.  
  226. <html><body><title>By Bluur - Fanatic Team</title>
  227. <br>
  228. <center>
  229. <table width=224>
  230.     <tr>
  231.         <td width=32><img src=Icon.etc_alphabet_l_i00 height=32 width=32></td>
  232.         <td width=32><img src=Icon.etc_alphabet_i_i00 height=32 width=32></td>
  233.         <td width=32><img src=Icon.etc_alphabet_n_i00 height=32 width=32></td>
  234.         <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
  235.         <td width=32><img src=Icon.etc_alphabet_a_i00 height=32 width=32></td>
  236.         <td width=32><img src=Icon.etc_alphabet_g_i00 height=32 width=32></td>
  237.         <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
  238.     </tr>
  239. </table>
  240. <br>
  241. <br>
  242. Player(s) online: <font color="00FF00">%online%</font></center>
  243. <br>
  244. <center><font color="LEVEL">Configure your character</font></center>
  245. <img src="L2UI.SquareGray" width=270 height=1>
  246. <table bgcolor="000000">
  247. <tr>
  248. <td width=5></td>
  249. <td width=105>Type</td>
  250. <td width=100>Currently</td>
  251. <td width=50>Action</td>
  252. </tr>
  253. </table>
  254. <img src="L2UI.SquareGray" width=270 height=1>
  255. <br>
  256.  
  257. <table bgcolor="000000">
  258. <tr>
  259. <td width=5></td>
  260. <td width=100>Party Refuse</td>
  261. <td width=100>%partyRefusal%</td>
  262. <td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setPartyRefuse" value="Alter"></td>
  263. </tr>
  264.  
  265. <tr>
  266. <td width=5></td>
  267. <td width=100>Trade Refusal</td>
  268. <td width=100>%tradeRefusal%</td>
  269. <td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setTradeRefuse" value="Alter"></td>
  270. </tr>
  271.  
  272. <tr>
  273. <td width=5></td>
  274. <td width=100>Buffs Refusal</td>
  275. <td width=100>%buffsRefusal%</td>
  276. <td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setbuffsRefuse" value="Alter"></td>
  277. </tr>
  278.  
  279. <tr>
  280. <td width=5></td>
  281. <td width=100>Message Refusal</td>
  282. <td width=100>%messageRefusal%</td>
  283. <td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setMessageRefuse" value="Alter"></td>
  284. </tr>
  285.  
  286. </table>
  287.  
  288. <br>
  289. <center>
  290. <img src="L2UI.SquareGray" width=160 height=1><br>
  291. <font color="LEVEL">Fanatic Team</font></center>
  292. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment