Comando .menu

Iniciado por Swarlog, Jun 25, 2025, 09:46 PM

Tema anterior - Siguiente tema

Swarlog


CitarCORE:

### Eclipse Workspace Patch 1.0
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Menu.java    (working copy)
@@ -0,0 +1,100 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ *
+ * @author Bluur
+ * @version 1.0
+ */
+
+public class Menu implements IVoicedCommandHandler
+{
+    private static final String[] _voicedCommands =
+    {
+        "menu",
+        "setPartyRefuse",
+        "setTradeRefuse",   
+        "setbuffsRefuse",
+        "setMessageRefuse",
+    };
+   
+    private static final String ACTIVED = "<font color=00FF00>ON</font>";
+    private static final String DESATIVED = "<font color=FF0000>OFF</font>";
+   
+    @Override
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {
+        if (command.equals("menu"))
+            showHtml(activeChar);       
+               
+        else if (command.equals("setPartyRefuse"))
+        {
+            if (activeChar.isPartyInRefuse())
+                activeChar.setIsPartyInRefuse(false);
+            else
+                activeChar.setIsPartyInRefuse(true);           
+            showHtml(activeChar);
+        }   
+        else if (command.equals("setTradeRefuse"))
+        {
+            if (activeChar.getTradeRefusal())
+                activeChar.setTradeRefusal(false);
+            else
+                activeChar.setTradeRefusal(true);
+            showHtml(activeChar);
+        }       
+        else if (command.equals("setMessageRefuse"))
+        {       
+            if (activeChar.isInRefusalMode())
+                activeChar.setInRefusalMode(false);
+            else
+                activeChar.setInRefusalMode(true);
+            showHtml(activeChar);
+        }
+        else if (command.equals("setbuffsRefuse"))
+        {       
+            if (activeChar.isBuffProtected())
+                activeChar.setIsBuffProtected(false);
+            else
+                activeChar.setIsBuffProtected(true);
+            showHtml(activeChar);
+        }
+        return true;
+    }
+   
+    private static void showHtml(L2PcInstance activeChar)
+    {
+        NpcHtmlMessage html = new NpcHtmlMessage(0);
+        html.setFile("data/html/mods/menu.htm");
+        html.replace("%online%", L2World.getInstance().getAllPlayersCount());   
+        html.replace("%partyRefusal%", activeChar.isPartyInRefuse() ? ACTIVED : DESATIVED);
+        html.replace("%tradeRefusal%", activeChar.getTradeRefusal() ? ACTIVED : DESATIVED);
+        html.replace("%buffsRefusal%", activeChar.isBuffProtected() ? ACTIVED : DESATIVED);
+        html.replace("%messageRefusal%", activeChar.isInRefusalMode() ? ACTIVED : DESATIVED);   
+        activeChar.sendPacket(html);
+    }
+   
+    @Override
+    public String[] getVoicedCommandList()
+    {
+        return _voicedCommands;
+    }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)

import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Menu;

        registerHandler(new Online());
+        registerHandler(new Menu());

Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Character.java    (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/L2Character.java    (working copy)
@@ -182,6 +184,18 @@
     
     private boolean _isRaid = false;
     
+    // protect From Debuffs
+    private boolean _isBuffProtected = false;
+    public void setIsBuffProtected(boolean value)
+    {
+        _isBuffProtected = value;
+    }
+           
+    public boolean isBuffProtected()
+    {
+        return _isBuffProtected;   
+    }

Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java    (revision 1)
+++ java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java    (working copy)
@@ -89,6 +89,15 @@
                     if (target.getFirstEffect(L2EffectType.BLOCK_BUFF) != null)
                         continue;
                     
+                    // Anti-Buff Protection prevents you from getting buffs by other players
+                    if (activeChar instanceof L2PcInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
+                        && (skill.getSkillType() == L2SkillType.BUFF                       
+                        || skill.getSkillType() == L2SkillType.HEAL_PERCENT
+                        || skill.getSkillType() == L2SkillType.MANAHEAL_PERCENT
+                        || skill.getSkillType() == L2SkillType.COMBATPOINTHEAL
+                        || skill.getSkillType() == L2SkillType.REFLECT))
+                    continue;
+                   
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -541,6 +541,7 @@
     private boolean _messageRefusal = false; // message refusal mode
     private boolean _tradeRefusal = false; // Trade refusal
     private boolean _exchangeRefusal = false; // Exchange refusal
+    private boolean _isPartyInRefuse = false; // Party Refusal Mode
     
@@ -7979,6 +7997,16 @@
         return _race[i];
     }
     
+    public boolean isPartyInRefuse()
+    {
+        return _isPartyInRefuse;
+    }
+
+    public void setIsPartyInRefuse(boolean value)
+    {
+        _isPartyInRefuse = value;
+    }
+   
     public boolean isInRefusalMode()
     {
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (working copy)
@@ -64,6 +72,18 @@
             return;
         }
         
+        if (target.isPartyInRefuse())
+        {
+            requestor.sendMessage("[Party Refuse]: Player in refusal party.");
+            return;
+        }
+       
         if (target.isInParty())
 
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (working copy)

+            if (_command.startsWith("voiced_"))
+            {
+                String command = _command.split(" ")[0];
+
+                IVoicedCommandHandler ach = VoicedCommandHandler.getInstance().getHandler(_command.substring(7));
+
+                if (ach == null)
+                {
+                    activeChar.sendMessage("The command " + command.substring(7) + " does not exist!");
+                    _log.warning("No handler registered for command '" + _command + "'");
+                    return;
+                }
+
+                ach.useVoicedCommand(_command.substring(7), activeChar, null);
+            }           
             else if (_command.startsWith("npc_"))
             {
                 if (!activeChar.validateBypass(_command))

CitarDATA:

<html><body><title>By Bluur - Fanatic Team</title>
<br>
<center>
<table width=224>
    <tr>
        <td width=32><img src=Icon.etc_alphabet_l_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_i_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_n_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_a_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_g_i00 height=32 width=32></td>
        <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
    </tr>
</table>
<br>
<br>
Player(s) online: <font color="00FF00">%online%</font></center>
<br>
<center><font color="LEVEL">Configure your character</font></center>
<img src="L2UI.SquareGray" width=270 height=1>
<table bgcolor="000000">
<tr>
<td width=5></td>
<td width=105>Type</td>
<td width=100>Currently</td>
<td width=50>Action</td>
</tr>
</table>
<img src="L2UI.SquareGray" width=270 height=1>
<br>

<table bgcolor="000000">
<tr>
<td width=5></td>
<td width=100>Party Refuse</td>
<td width=100>%partyRefusal%</td>
<td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setPartyRefuse" value="Alter"></td>
</tr>

<tr>
<td width=5></td>
<td width=100>Trade Refusal</td>
<td width=100>%tradeRefusal%</td>
<td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setTradeRefuse" value="Alter"></td>
</tr>

<tr>
<td width=5></td>
<td width=100>Buffs Refusal</td>
<td width=100>%buffsRefusal%</td>
<td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setbuffsRefuse" value="Alter"></td>
</tr>

<tr>
<td width=5></td>
<td width=100>Message Refusal</td>
<td width=100>%messageRefusal%</td>
<td width=50><button width=35 height=15 back="sek.cbui94" fore="sek.cbui94" action="bypass -h voiced_setMessageRefuse" value="Alter"></td>
</tr>

</table>

<br>
<center>
<img src="L2UI.SquareGray" width=160 height=1><br>
<font color="LEVEL">Fanatic Team</font></center>
</body></html>