Noticias:

Menú Principal

Mensajes recientes

#81
L2 | Comandos / Comando .email
Último mensaje por Swarlog - Jun 25, 2025, 09:47 PM
Lo acabo de crear ahora mismo, he utilizado de base el de cambiar password. Aun no lo he probado, pero creo que esta todo correctamente. Lo que sea me avisen, espero que les sea de utilidad.

Se trata de un comando para cambiar de correo electronico de vuestra cuenta, ponen en chat .email y listo! Ya habia varios sistemas antiguos, este lo he adaptado a la última versión de l2j-server High Five. Un saludo ^^

CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2Dev_ChangeEmail_Core
Index: dist/game/config/L2JMods.properties
===================================================================
--- dist/game/config/L2JMods.properties (revision 13050)
+++ dist/game/config/L2JMods.properties (working copy)
@@ -492,7 +492,17 @@
 # Default: 127.0.0.1,0 (no limits from localhost)
 DualboxCheckWhitelist = 127.0.0.1,0
 
+
 # ---------------------------------------------------------------------------
+# Email Change
+# ---------------------------------------------------------------------------
+
+# Enables .email voiced command which allows the players to change their account's email ingame.
+# Requires custom modification in sql --> Data\dist\sql\login\custom\email.sql
+# Default: False
+AllowChangeEmail = False
+
+# ---------------------------------------------------------------------------
 # Password Change
 # ---------------------------------------------------------------------------
 
Index: java/com/l2jserver/gameserver/network/loginserverpackets/ChangeEmailResponse.java
===================================================================
--- java/com/l2jserver/gameserver/network/loginserverpackets/ChangeEmailResponse.java (revision 0)
+++ java/com/l2jserver/gameserver/network/loginserverpackets/ChangeEmailResponse.java (working copy)
@@ -0,0 +1,37 @@
+/*
+ * 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 com.l2jserver.gameserver.network.loginserverpackets;
+
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.network.BaseRecievePacket;
+
+public class ChangeEmailResponse extends BaseRecievePacket
+{
+ public ChangeEmailResponse(byte[] decrypt)
+ {
+ super(decrypt);
+ // boolean isSuccessful = readC() > 0;
+ String character = readS();
+ String msgToSend = readS();
+
+ L2PcInstance player = L2World.getInstance().getPlayer(character);
+ if (player != null)
+ {
+ player.sendMessage(msgToSend);
+ }
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/loginserver/network/gameserverpackets/ChangeEmail.java
===================================================================
--- java/com/l2jserver/loginserver/network/gameserverpackets/ChangeEmail.java (revision 0)
+++ java/com/l2jserver/loginserver/network/gameserverpackets/ChangeEmail.java (working copy)
@@ -0,0 +1,127 @@
+/*
+ * 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 com.l2jserver.loginserver.network.gameserverpackets;
+
+import java.security.MessageDigest;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Base64;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.loginserver.GameServerTable;
+import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
+import com.l2jserver.loginserver.GameServerThread;
+import com.l2jserver.util.network.BaseRecievePacket;
+
+public class ChangeEmail extends BaseRecievePacket
+{
+ protected static Logger _log = Logger.getLogger(ChangeEmail.class.getName());
+ private static GameServerThread gst = null;
+
+ public ChangeEmail(byte[] decrypt)
+ {
+ super(decrypt);
+
+ String accountName = readS();
+ String characterName = readS();
+ String curEmail = readS();
+ String newEmail = readS();
+
+ // get the GameServerThread
+ Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values();
+ for (GameServerInfo gsi : serverList)
+ {
+ if ((gsi.getGameServerThread() != null) && gsi.getGameServerThread().hasAccountOnGameServer(accountName))
+ {
+ gst = gsi.getGameServerThread();
+ }
+ }
+
+ if (gst == null)
+ {
+ return;
+ }
+
+ if ((curEmail == null) || (newEmail == null))
+ {
+ gst.ChangeEmailResponse((byte) 0, characterName, "Invalid email data! Try again.");
+ }
+ else
+ {
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+
+ byte[] raw = curEmail.getBytes("UTF-8");
+ raw = md.digest(raw);
+ byte[] _oldEmail = raw;
+ String _email = null;
+ int _newEmail = 0;
+
+ // SQL connection
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement("SELECT email FROM accounts WHERE login=?"))
+ {
+ ps.setString(1, accountName);
+ try (ResultSet rs = ps.executeQuery())
+ {
+ if (rs.next())
+ {
+ _email = rs.getString("email");
+ }
+ }
+ }
+
+ if (curEmail.equals(_email))
+ {
+ byte[] email = newEmail.getBytes("UTF-8");
+ email = md.digest(email);
+
+ // SQL connection
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement("UPDATE accounts SET email=? WHERE login=?"))
+ {
+ ps.setString(1, Base64.getEncoder().encodeToString(email));
+ ps.setString(2, accountName);
+ _newEmail = ps.executeUpdate();
+ }
+
+ _log.log(Level.INFO, "The email for account " + accountName + " has been changed from " + _oldEmail + " to " + email);
+ if (_newEmail > 0)
+ {
+ gst.ChangeEmailResponse((byte) 1, characterName, "You have successfully changed your email!");
+ }
+ else
+ {
+ gst.ChangeEmailResponse((byte) 0, characterName, "The email change was unsuccessful!");
+ }
+ }
+ else
+ {
+ gst.ChangeEmailResponse((byte) 0, characterName, "The typed current email doesn't match with your current one.");
+ }
+ }
+ catch (Exception e)
+ {
+ _log.warning("Error while changing email for account " + accountName + " requested by player " + characterName + "! " + e);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/LoginServerThread.java
===================================================================
--- java/com/l2jserver/gameserver/LoginServerThread.java (revision 13050)
+++ java/com/l2jserver/gameserver/LoginServerThread.java (working copy)
@@ -54,6 +54,7 @@
 import com.l2jserver.gameserver.network.gameserverpackets.AuthRequest;
 import com.l2jserver.gameserver.network.gameserverpackets.BlowFishKey;
 import com.l2jserver.gameserver.network.gameserverpackets.ChangeAccessLevel;
+import com.l2jserver.gameserver.network.gameserverpackets.ChangeEmail;
 import com.l2jserver.gameserver.network.gameserverpackets.ChangePassword;
 import com.l2jserver.gameserver.network.gameserverpackets.PlayerAuthRequest;
 import com.l2jserver.gameserver.network.gameserverpackets.PlayerInGame;
@@ -64,6 +65,7 @@
 import com.l2jserver.gameserver.network.gameserverpackets.ServerStatus;
 import com.l2jserver.gameserver.network.gameserverpackets.TempBan;
 import com.l2jserver.gameserver.network.loginserverpackets.AuthResponse;
+import com.l2jserver.gameserver.network.loginserverpackets.ChangeEmailResponse;
 import com.l2jserver.gameserver.network.loginserverpackets.ChangePasswordResponse;
 import com.l2jserver.gameserver.network.loginserverpackets.InitLS;
 import com.l2jserver.gameserver.network.loginserverpackets.KickPlayer;
@@ -345,6 +347,9 @@
  case 0x06:
  new ChangePasswordResponse(incoming);
  break;
+ case 0x07:
+ new ChangeEmailResponse(incoming);
+ break;
  }
  }
  }
@@ -704,6 +709,25 @@
  }
 
  /**
+ * Send change email.
+ * @param accountName the account name
+ * @param charName the char name
+ * @param oldEmail the old pass
+ * @param newEmail the new pass
+ */
+ public void sendChangeEmail(String accountName, String charName, String oldEmail, String newEmail)
+ {
+ ChangeEmail ce = new ChangeEmail(accountName, charName, oldEmail, newEmail);
+ try
+ {
+ sendPacket(ce);
+ }
+ catch (IOException e)
+ {
+ }
+ }
+
+ /**
  * Gets the status string.
  * @return the status string
  */
Index: java/com/l2jserver/loginserver/GameServerThread.java
===================================================================
--- java/com/l2jserver/loginserver/GameServerThread.java (revision 13050)
+++ java/com/l2jserver/loginserver/GameServerThread.java (working copy)
@@ -34,6 +34,7 @@
 import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
 import com.l2jserver.loginserver.network.L2JGameServerPacketHandler;
 import com.l2jserver.loginserver.network.L2JGameServerPacketHandler.GameServerState;
+import com.l2jserver.loginserver.network.loginserverpackets.ChangeEmailResponse;
 import com.l2jserver.loginserver.network.loginserverpackets.ChangePasswordResponse;
 import com.l2jserver.loginserver.network.loginserverpackets.InitLS;
 import com.l2jserver.loginserver.network.loginserverpackets.KickPlayer;
@@ -282,6 +283,11 @@
  sendPacket(new ChangePasswordResponse(successful, characterName, msgToSend));
  }
 
+ public void ChangeEmailResponse(byte successful, String characterName, String msgToSend)
+ {
+ sendPacket(new ChangeEmailResponse(successful, characterName, msgToSend));
+ }
+
  /**
  * @param hosts The gameHost to set.
  */
Index: java/com/l2jserver/gameserver/network/gameserverpackets/ChangeEmail.java
===================================================================
--- java/com/l2jserver/gameserver/network/gameserverpackets/ChangeEmail.java (revision 0)
+++ java/com/l2jserver/gameserver/network/gameserverpackets/ChangeEmail.java (working copy)
@@ -0,0 +1,36 @@
+/*
+ * 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 com.l2jserver.gameserver.network.gameserverpackets;
+
+import com.l2jserver.util.network.BaseSendablePacket;
+
+public class ChangeEmail extends BaseSendablePacket
+{
+ public ChangeEmail(String accountName, String characterName, String oldEmail, String newEmail)
+ {
+ writeC(0x0B);
+ writeS(accountName);
+ writeS(characterName);
+ writeS(oldEmail);
+ writeS(newEmail);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
Index: java/com/l2jserver/loginserver/network/loginserverpackets/ChangeEmailResponse.java
===================================================================
--- java/com/l2jserver/loginserver/network/loginserverpackets/ChangeEmailResponse.java (revision 0)
+++ java/com/l2jserver/loginserver/network/loginserverpackets/ChangeEmailResponse.java (working copy)
@@ -0,0 +1,35 @@
+/*
+ * 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 com.l2jserver.loginserver.network.loginserverpackets;
+
+import com.l2jserver.util.network.BaseSendablePacket;
+
+public class ChangeEmailResponse extends BaseSendablePacket
+{
+ public ChangeEmailResponse(byte successful, String characterName, String msgToSend)
+ {
+ writeC(0x07);
+ // writeC(successful); //0 false, 1 true
+ writeS(characterName);
+ writeS(msgToSend);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 13050)
+++ java/com/l2jserver/Config.java (working copy)
@@ -770,6 +770,7 @@
  public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
  public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
  public static Map<Integer, Integer> L2JMOD_DUALBOX_CHECK_WHITELIST;
+ public static boolean L2JMOD_ALLOW_CHANGE_EMAIL;
  public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
  // --------------------------------------------------
  // NPC Settings
@@ -2500,6 +2501,8 @@
  }
  }
  }
+
+ L2JMOD_ALLOW_CHANGE_EMAIL = L2JModSettings.getBoolean("AllowChangeEmail", false);
  L2JMOD_ALLOW_CHANGE_PASSWORD = L2JModSettings.getBoolean("AllowChangePassword", false);
 
  // Load PvP L2Properties file (if exists)

CitarDATA:

### Eclipse Workspace Patch 1.0
#P L2Dev_ChangeEmail_Data
Index: dist/sql/login/custom/email.sql
===================================================================
--- dist/sql/login/custom/email.sql (revision 0)
+++ dist/sql/login/custom/email.sql (working copy)
@@ -0,0 +1 @@
+ALTER TABLE `accounts` ADD `email` VARCHAR(255) NULL DEFAULT NULL ;
\ No newline at end of file
Index: dist/game/data/html/mods/ChangeEmail.htm
===================================================================
--- dist/game/data/html/mods/ChangeEmail.htm (revision 0)
+++ dist/game/data/html/mods/ChangeEmail.htm (working copy)
@@ -0,0 +1,10 @@
+<html><body>
+<center>
+<td>
+<tr>Current Email:</tr><tr><edit type="email" var="oldemail" width=150></tr><br>
+<tr>New Email</tr><tr><edit type="email" var="newemail" width=150></tr><br>
+<tr>Repeat New Email</tr><tr><edit type="email" var="repeatnewemail" width=150></tr><br>
+<td>
+<button value="Change Email" action="bypass -h voice .email $oldemail $newemail $repeatnewemail" width=160 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
+</center>
+</body></html>
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java (working copy)
@@ -0,0 +1,107 @@
+/*
+ * 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 handlers.voicedcommandhandlers;
+
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+
+import com.l2jserver.gameserver.LoginServerThread;
+import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+
+public class ChangeEmail implements IVoicedCommandHandler
+{
+ private static final String[] _voicedCommands =
+ {
+ "email"
+ };
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (target != null)
+ {
+ final StringTokenizer st = new StringTokenizer(target);
+ try
+ {
+ String curpass = null, newpass = null, repeatnewpass = null;
+ if (st.hasMoreTokens())
+ {
+ curpass = st.nextToken();
+ }
+ if (st.hasMoreTokens())
+ {
+ newpass = st.nextToken();
+ }
+ if (st.hasMoreTokens())
+ {
+ repeatnewpass = st.nextToken();
+ }
+
+ if (!((curpass == null) || (newpass == null) || (repeatnewpass == null)))
+ {
+ if (!newpass.equals(repeatnewpass))
+ {
+ activeChar.sendMessage("The new email doesn't match with the repeated one!");
+ return false;
+ }
+ if (newpass.length() < 3)
+ {
+ activeChar.sendMessage("The new email is shorter than 3 chars! Please try with a longer one.");
+ return false;
+ }
+ if (newpass.length() > 30)
+ {
+ activeChar.sendMessage("The new email is longer than 30 chars! Please try with a shorter one.");
+ return false;
+ }
+
+ LoginServerThread.getInstance().sendChangeEmail(activeChar.getAccountName(), activeChar.getName(), curpass, newpass);
+ }
+ else
+ {
+ activeChar.sendMessage("Invalid email data! You have to fill all boxes.");
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ activeChar.sendMessage("A problem occured while changing email!");
+ _log.log(Level.WARNING, "", e);
+ }
+ }
+ else
+ {
+ // showHTML(activeChar);
+ String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangeEmail.htm");
+ if (html == null)
+ {
+ html = "<html><body><br><br><center><font color=LEVEL>404:</font> File Not Found</center></body></html>";
+ }
+ activeChar.sendPacket(new NpcHtmlMessage(html));
+ return true;
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return _voicedCommands;
+ }
+}
Index: .classpath
===================================================================
--- .classpath (revision 21974)
+++ .classpath (working copy)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
- <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts" />
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
- <classpathentry combineaccessrules="false" kind="src" path="/L2J_Server" />
- <classpathentry kind="lib" path="/L2J_Server/dist/libs/mmocore.jar" />
- <classpathentry kind="output" path="bin" />
-</classpath>
\ No newline at end of file
+ <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/L2Dev_ChangeEmail_Core"/>
+ <classpathentry kind="lib" path="/L2Dev_ChangeEmail_Core/dist/libs/mmocore.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 21974)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -249,6 +249,7 @@
 import handlers.usercommandhandlers.Time;
 import handlers.usercommandhandlers.Unstuck;
 import handlers.voicedcommandhandlers.Banking;
+import handlers.voicedcommandhandlers.ChangeEmail;
 import handlers.voicedcommandhandlers.ChangePassword;
 import handlers.voicedcommandhandlers.ChatAdmin;
 import handlers.voicedcommandhandlers.Debug;
@@ -531,6 +532,7 @@
  (Config.L2JMOD_CHAT_ADMIN ? ChatAdmin.class : null),
  (Config.L2JMOD_MULTILANG_ENABLE && Config.L2JMOD_MULTILANG_VOICED_ALLOW ? Lang.class : null),
  (Config.L2JMOD_DEBUG_VOICE_COMMAND ? Debug.class : null),
+ (Config.L2JMOD_ALLOW_CHANGE_EMAIL ? ChangeEmail.class : null),
  (Config.L2JMOD_ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null),
  },
  {
Index: dist/sql/login/custom/email.sql
===================================================================
--- dist/sql/login/custom/email.sql (revision 0)
+++ dist/sql/login/custom/email.sql (working copy)
@@ -0,0 +1 @@
+ALTER TABLE `accounts` ADD `email` VARCHAR(255) NULL DEFAULT NULL ;
\ No newline at end of file
#82
L2 | Comandos / Comandos .fighterbuff / .mageb...
Último mensaje por Swarlog - Jun 25, 2025, 09:47 PM
/* This program is free software; you can redistribute it and/or modify */
package com.l2jfree.gameserver.handler.voicedcommandhandlers;

import javolution.util.FastList;
import com.l2jfree.gameserver.datatables.BuffTemplateTable;
import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.model.L2Skill.SkillType;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.SystemMessageId;
import com.l2jfree.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jfree.gameserver.network.serverpackets.SystemMessage;
import com.l2jfree.gameserver.templates.L2BuffTemplate;

/**
* @author v
*
*/
public class Buffz implements IVoicedCommandHandler
{
   //private static final Log _log = LogFactory.getLog(Wedding.class);
   private static String[] _voicedCommands = { "fighterbuff","magebuff" };

   /* (non-Javadoc)
    * @see com.l2jfree.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jfree.gameserver.model.L2PcInstance)
    */
   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
   {
       if(activeChar!=null)
       {
        FastList<L2BuffTemplate> _templateBuffs = new FastList<L2BuffTemplate>();
           
           boolean _wasInvul=false;
           
           if(command.startsWith("fighterbuff"))
            _templateBuffs = BuffTemplateTable.getInstance().getBuffTemplate(98);
           else
            _templateBuffs = BuffTemplateTable.getInstance().getBuffTemplate(99);
           
    if (_templateBuffs == null || _templateBuffs.size() == 0)
    return false;
           
    activeChar.setTarget(activeChar);
           
    //is this really need?
    double _mp=activeChar.getStatus().getCurrentMp(); //to disable mp consuming
   
    // for those who is invulnerable
    if(activeChar.isInvul()&&activeChar.isGM())
        {
        _wasInvul=true;
        activeChar.setIsInvul(false);
        }
   
           for (L2BuffTemplate _buff:_templateBuffs)
           {
               if ( _buff.checkPlayer(activeChar))
               {
               
                   // regeneration ^^ //is this really need?
                activeChar.getStatus().setCurrentMp(_mp);
                   String _name="";
                   
                   // some more functions depending on _buff name
                   if(_buff.getName().equalsIgnoreCase("RestoreHpMp")) {
                      MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, _buff.getSkillId(), _buff.getSkillLevel(), 110, 0);
                      activeChar.broadcastPacket(msu);
                      activeChar.getStatus().setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
                      _name="Health and Mana Restoration";
                   }
                   else if(_buff.getName().equalsIgnoreCase("Heal")) {
                    MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, _buff.getSkillId(), _buff.getSkillLevel(), 110, 0);
                    activeChar.broadcastPacket(msu);
                    activeChar.getStatus().setCurrentHp(activeChar.getMaxHp());
                    _name="Health Restoration";
                   }
                   else if(_buff.getName().equalsIgnoreCase("Mana"))
                   {
                    MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, _buff.getSkillId(), _buff.getSkillLevel(), 110, 0);
                    activeChar.broadcastPacket(msu);
                    activeChar.getStatus().setCurrentMp(activeChar.getMaxMp());
                    _name="Mana Restoration";
                   }
                   else if(_buff.getName().equalsIgnoreCase("CP"))
                   {
                    MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, _buff.getSkillId(), _buff.getSkillLevel(), 110, 0);
                    activeChar.broadcastPacket(msu);
                    activeChar.getStatus().setCurrentCp(activeChar.getMaxCp());
                    _name="Combat Points Restoration";
                   }
                   else if (_buff.getSkill().getSkillType() == SkillType.SUMMON)
                    activeChar.doCast(_buff.getSkill());
                       
                   else
                   {   
                    // if this buff is first buff of this category - show animation
                    if(_templateBuffs.getFirst()==_buff){
                    MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, _buff.getSkillId(), _buff.getSkillLevel(), 200, 0);
                    activeChar.broadcastPacket(msu);
                    try{
                    Thread.sleep(200);//is this really need?
                    }catch (Exception f) {}
                    }
                    // buff process :D
                    _buff.getSkill().getEffects(activeChar, activeChar);
                   }
                   //text part
                   SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
                   if (_name.equalsIgnoreCase("")||_name==null)
                    sm.addSkillName(_buff.getSkill().getId());
                   else sm.addString(_name);
                   activeChar.sendPacket(sm);
                   sm = null;
               }
               else return false;
           }
           if(_wasInvul&&activeChar.isGM())
           {
            activeChar.setIsInvul(true);
            _wasInvul=false;
           }   
           return true;
       }
       else
           return false;
   }
   
   /* (non-Javadoc)
    * @see com.l2jfree.gameserver.handler.IUserCommandHandler#getUserCommandList()
    */
   public String[] getVoicedCommandList()
   {
       return _voicedCommands;
   }
}   

INSERT INTO `buff_templates` VALUES ('98', 'Ww', '1204', 'Wind Walk', '2', '1', '1', '1', '80', '0', '0', '0', '1000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'sh', '1040', 'Shield', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'mi', '1068', 'Might', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'ms', '1035', 'Mental Shield', '4', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'btb', '1045', 'Bless the Body', '6', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'bts', '1048', 'Bless the Soul', '6', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'mb', '1036', 'Magic Barrier', '2', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'rs', '1259', 'Resist Shock', '4', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'dw', '1257', 'Decrease Weight', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'bers', '1062', 'Berserker Spirit', '2', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'vamp', '1268', 'Vampiric Rage', '4', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'hast', '1086', 'Haste', '2', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'gui', '1240', 'Guidance', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'foc', '1077', 'Focus', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'dea', '1242', 'Death Whisper', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'life', '1229', 'Chant of Life', '18', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'ward', '267', 'Song of Warding', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'wind', '268', 'Song of Wind', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'hunt', '269', 'Song of Hunter', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'vita', '304', 'Song of Vitality', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'venge', '305', 'Song of Vengeance', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'storm', '308', 'Song of Storm Guard', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'rene', '349', 'Song of Renewal', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'reveng', '1284', 'Chant of Revenge', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'victory', '1363', 'Chant of Victory', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'warrior', '271', 'Dance of Warrior', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'fire', '274', 'Dance of Fire', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'fury', '275', 'Dance of Fury', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'vampi', '310', 'Dance of Vampire', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'heal', '1218', 'Greater Battle Heal', '33', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'Ww11', '1204', 'Wind Walk', '2', '1', '1', '1', '80', '0', '0', '0', '1000', '0');
INSERT INTO `buff_templates` VALUES ('99', 's11h', '1040', 'Shield', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('98', 'm11i', '1068', 'Might', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'm11s', '1035', 'Mental Shield', '4', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'bt11b', '1045', 'Bless the Body', '6', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'bt11s', '1048', 'Bless the Soul', '6', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'm11b', '1036', 'Magic Barrier', '2', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'r11s', '1259', 'Resist Shock', '4', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'co11ns', '1078', 'Concentration', '6', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'd11w', '1257', 'Decrease Weight', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'be11rs', '1062', 'Berserker Spirit', '2', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'a11cu', '1085', 'Acumen', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'em11p', '1059', 'Empower', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'wa11rd', '267', 'Song of Warding', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'wi11nd', '268', 'Song of Wind', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'vi1ta', '304', 'Song of Vitality', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'ven1ge', '305', 'Song of Vengeance', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'st1orm', '308', 'Song of Storm Guard', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 're1ne', '349', 'Song of Renewal', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 're1veng', '1284', 'Chant of Revenge', '3', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'vi1ctory', '1363', 'Chant of Victory', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'mys1tic', '273', 'Dance of Mystic', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'c1once', '276', 'Dance of Concentration', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'si1ren', '365', 'Dance of Siren', '1', '1', '1', '1', '80', '0', '0', '0', '30000', '0');
INSERT INTO `buff_templates` VALUES ('99', 'h1eal', '1218', 'Greater Battle Heal', '33', '1', '1', '1', '80', '0', '0', '0', '30000', '0');

Creditos: VaneSs11
#83
L2 | Comandos / Comando Clan Full
Último mensaje por Swarlog - Jun 25, 2025, 09:47 PM
Comando para hacer clan full skill lvl y ademas dar puntos de reputacion todo en un solo comando //clanfull

### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java (revision 1004)
+++ head-src/com/l2jfrozen/Config.java (working copy)
@@ -1140,6 +1140,11 @@
 
public static boolean ALT_MOBS_STATS_BONUS;
 public static boolean ALT_PETS_STATS_BONUS;
+ /** Clan Full **/
+ public static boolean ENABLE_CLAN_SYSTEM;
+ public static Map<Integer, Integer> CLAN_SKILLS;
+ public static byte CLAN_LEVEL;
+ public static int REPUTATION_QUANTITY;
 
//============================================================
 public static void loadAltConfig()
@@ -1304,8 +1309,41 @@
 MAX_SUBCLASS_LEVEL = Byte.parseByte(altSettings.getProperty("MaxSubclassLevel", "81"));
 
ALT_MOBS_STATS_BONUS = Boolean.parseBoolean(altSettings.getProperty("AltMobsStatsBonus", "True"));
- ALT_PETS_STATS_BONUS = Boolean.parseBoolean(altSettings.getProperty("AltPetsStatsBonus", "True"));
- }
+ ALT_PETS_STATS_BONUS = Boolean.parseBoolean(altSettings.getProperty("AltPetsStatsBonus", "True"));
+ /** Clan Full **/
+ ENABLE_CLAN_SYSTEM = Boolean.parseBoolean(altSettings.getProperty("EnableClanSystem", "True"));
+ if (ENABLE_CLAN_SYSTEM)
+ {
+ String AioSkillsSplit[] = altSettings.getProperty("ClanSkills", "").split(";");
+ CLAN_SKILLS = new FastMap<Integer, Integer>(AioSkillsSplit.length);
+ String arr[] = AioSkillsSplit;
+ int len = arr.length;
+ for (int i = 0; i < len; i++)
+ {
+ String skill = arr[i];
+ String skillSplit[] = skill.split(",");
+ if (skillSplit.length != 2)
+ {
+ System.out.println((new StringBuilder()).append("[Clan System]: invalid config property in Mods/L2JHellas.ini -> ClanSkills \"").append(skill).append("\"").toString());
+ continue;
+ }
+ try
+ {
+ CLAN_SKILLS.put(Integer.valueOf(Integer.parseInt(skillSplit[0])), Integer.valueOf(Integer.parseInt(skillSplit[1])));
+ continue;
+ }
+ catch (NumberFormatException nfe)
+ {
+ }
+ if (!skill.equals(""))
+ {
+ System.out.println((new StringBuilder()).append("[Clan System]: invalid config property in Mods/L2JHellas.ini -> ClanSkills \"").append(skillSplit[0]).append("\"").append(skillSplit[1]).toString());
+ }
+ }
+ }
+ CLAN_LEVEL = Byte.parseByte(altSettings.getProperty("ClanSetLevel", "8"));
+ REPUTATION_QUANTITY = Integer.parseInt(altSettings.getProperty("ReputationScore", "10000"));
+        }
 catch(Exception e)
 {
 e.printStackTrace();
Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminClanFull.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminClanFull.java (revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminClanFull.java (working copy)
@@ -0,0 +1,83 @@
+/*
+ * 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 com.l2jfrozen.gameserver.handler.admincommandhandlers;
+
+import com.l2jfrozen.Config;
+import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
+import com.l2jfrozen.gameserver.model.L2Object;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
+import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate;
+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
+
+public class AdminClanFull implements IAdminCommandHandler
+{
+ private static final String ADMIN_COMMANDS[] =
+ {
+ "admin_clanfull"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if (command.startsWith("admin_clanfull"))
+ {
+ try
+ {
+ adminAddClanSkill(activeChar);
+ activeChar.sendMessage("Sucessfull usage //clanfull !");
+ }
+ catch (Exception e)
+ {
+ activeChar.sendMessage("Usage: //clanfull");
+ }
+ }
+ return true;
+ }
+
+ private void adminAddClanSkill(L2PcInstance activeChar)
+ {
+ L2Object target = activeChar.getTarget();
+ L2PcInstance player = null;
+
+ if (target == null)
+ target = activeChar;
+
+ if (target instanceof L2PcInstance)
+ {
+ player = (L2PcInstance) target;
+ }
+ else
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
+ return;
+ }
+
+ if (!player.isClanLeader())
+ {
+ player.sendPacket((new SystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER)).addString(player.getName()));
+ return;
+ }
+ player.getClan().changeLevel(Config.CLAN_LEVEL);
+ player.ClanSkills();
+ player.sendPacket(new EtcStatusUpdate(activeChar));
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
Index: config/head/altsettings.properties
===================================================================
--- config/head/altsettings.properties (revision 1004)
+++ config/head/altsettings.properties (working copy)
@@ -364,4 +364,21 @@
 # False: All Monster Instances have the Bonus of Stats. (Hard to kill)
 # We got the correct value on database, so disable it.
 # Default: True
-AltPetsStatsBonus = True
\ No newline at end of file
+AltPetsStatsBonus = True
+
+##############################################
+#                 Clan Full Comand           #
+##############################################
+
+# Enable and Disable Command //clanfull
+EnableClanSystem = True
+
+# List of Skills reward for clan usage //clanfull
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+ClanSkills = 370,3;371,3;372,3;373,3;374,3;375,3;376,3;377,3;378,3;379,3;380,3;381,3;382,3;383,3;384,3;385,3;386,3;387,3;388,3;389,3;390,3;391,3;
+
+# LvL Clan Reward Usage //clanfull
+ClanSetLevel = 8
+
+# Quantity Reputation Points Reward for usage //clanfull
+ReputationScore = 10000
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -37,6 +37,7 @@
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCharSupervision;
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChristmas;
+import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminClanFull;
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCreateItem;
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
 import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminDMEngine;
@@ -120,6 +121,7 @@
 _datatable = new FastMap<String, IAdminCommandHandler>();
 registerAdminCommandHandler(new AdminAdmin());
 registerAdminCommandHandler(new AdminInvul());
+ registerAdminCommandHandler(new AdminClanFull());
 registerAdminCommandHandler(new AdminDelete());
 registerAdminCommandHandler(new AdminKill());
 registerAdminCommandHandler(new AdminTarget());
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -14815,6 +14815,27 @@
 {
 _fishing = fishing;
 }
+
+       public void ClanSkills()
+       {
+               for(Iterator i$ = Config.CLAN_SKILLS.keySet().iterator(); i$.hasNext(); broadcastUserInfo())
+               {
+                       Integer skillid = (Integer)i$.next();
+                       int skilllvl = ((Integer)Config.CLAN_SKILLS.get(skillid)).intValue();
+                       L2Skill skill = SkillTable.getInstance().getInfo(skillid.intValue(), skilllvl);
+                       if(skill != null)
+                               addSkill(skill, true);
+                       getClan().addNewSkill(skill);
+                       sendSkillList();
+               }
+
+               L2Clan clan = getClan();
+               clan.setReputationScore(clan.getReputationScore() + Config.REPUTATION_QUANTITY, true);
+               sendMessage((new StringBuilder()).append("Admin give to you ").append(Config.REPUTATION_QUANTITY).append(" Reputation Points.").toString());
+               sendMessage("GM give to you all Clan Skills");
+       }
 
/**
 * Sets the alliance with varka ketra.

By Cafi
#84
L2 | Comandos / Comando .buff
Último mensaje por Swarlog - Jun 25, 2025, 09:47 PM

CORE:

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)
@@ -20,18 +20,29 @@

 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.BuffCommand;
+import net.sf.l2j.gameserver.datatables.SkillTable;

@@ -89,10 +100,218 @@
               
             else if (_command.startsWith("player_help "))
             {
                 playerHelp(activeChar, _command.substring(12));
             }
+            // start voiced .buff command
+            else if (_command.startsWith("buffCommandFight"))
+            {
+                BuffCommand.getFullBuff(activeChar, false);
+            }           
+            else if (_command.startsWith("buffCommandMage"))
+            {
+                BuffCommand.getFullBuff(activeChar, true);
+            }
+            else if (_command.startsWith("buffCommand") && BuffCommand.check(activeChar))
+            {
+                String idBuff = _command.substring(12);
+                int parseIdBuff = Integer.parseInt(idBuff);
+                SkillTable.getInstance().getInfo(parseIdBuff, SkillTable.getInstance().getMaxLevel(parseIdBuff)).getEffects(activeChar, activeChar);
+                BuffCommand.showHtml(activeChar);
+            }
+            else if (_command.startsWith("cancelBuffs") && BuffCommand.check(activeChar))
+            {
+                activeChar.stopAllEffectsExceptThoseThatLastThroughDeath();
+                BuffCommand.showHtml(activeChar);
+            }
+            // end voiced .buff command

Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/BuffCommand.java    (working copy)
@@ -0,0 +1,59 @@
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.zone.ZoneId;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ *
+ * @author Bluur
+ *
+ */
+public class BuffCommand implements IVoicedCommandHandler
+{
+    private final String[] _voicedCommands =
+    {
+        "buff"
+    };
+   
+    @Override
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {   
+        if (check(activeChar)) //retorna               
+            showHtml(activeChar);   
+       
+        return true;
+    }
+   
+    public static void getFullBuff(L2PcInstance p, boolean isClassMage)
+    {
+        if (check(p))
+        {
+            if (isClassMage)
+            {
+                for (int b : Config.BUFF_COMMAND_MAGE_IDBUFFS)   
+                     SkillTable.getInstance().getInfo(b, SkillTable.getInstance().getMaxLevel(b)).getEffects(p, p);       
+            }
+            else
+            {
+                for (int b : Config.BUFF_COMMAND_FIGHT_IDBUFFS)   
+                     SkillTable.getInstance().getInfo(b, SkillTable.getInstance().getMaxLevel(b)).getEffects(p, p);       
+            }
+            p.sendMessage("[Buff Command]: Voce foi buffado!");
+        }       
+    }
+   
+    public static boolean check(L2PcInstance p)
+    {       
+        return p.isInsideZone(ZoneId.PEACE) && !p.isInCombat() && !p.isInOlympiadMode(); //restrições
+    }
+   
+    public static void showHtml(L2PcInstance player)
+    {     
+        NpcHtmlMessage html = new NpcHtmlMessage(0);   
+        html.setFile("data/html/mods/buffCommand.htm");
+        html.replace("%currentBuffs%", player.getBuffCount());
+        html.replace("%getMaxBuffs%", player.getMaxBuffCount());
+        player.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)
@@ -0,0 +1,94 @@

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

    protected VoicedCommandHandler()
    {
        registerHandler(new Online());
+       registerHandler(new BuffCommand());

Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 1)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -484,6 +484,11 @@

     public static boolean STORE_SKILL_COOLTIME;
     public static int BUFFS_MAX_AMOUNT;
 
+    /** Voiced buff command */
+    public static String LIST_BUFF_COMMAND;
+    public static int[] BUFF_COMMAND_FIGHT_IDBUFFS;
+    public static int[] BUFF_COMMAND_MAGE_IDBUFFS;
+   

            STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);                                                           
+               
+            LIST_BUFF_COMMAND = players.getProperty("buffCommandFightBuffsID", "123,456");
+       
+            String[] buffCommand = LIST_BUFF_COMMAND.split(",");           
+            BUFF_COMMAND_FIGHT_IDBUFFS = new int[buffCommand.length];       
+            for (int i = 0; i < buffCommand.length; i++)
+                BUFF_COMMAND_FIGHT_IDBUFFS[i] = Integer.parseInt(buffCommand[i]);
+           
+            LIST_BUFF_COMMAND = players.getProperty("buffCommandMageBuffsID", "789,1011112");
+           
+            buffCommand = LIST_BUFF_COMMAND.split(",");           
+            BUFF_COMMAND_MAGE_IDBUFFS = new int[buffCommand.length];           
+            for (int i = 0; i < buffCommand.length; i++)
+                BUFF_COMMAND_MAGE_IDBUFFS[i] = Integer.parseInt(buffCommand[i]);

Index: config/players.properties
===================================================================
--- config/players.properties    (revision 1)
+++ config/players.properties    (working copy)
@@ -288,4 +288,14 @@

StoreSkillCooltime = True
+
+#=============================================================
+#                    Voiced .buff Command  by Bluur
+#=============================================================
+
+# List of ID buffs - FIGHT -
+buffCommandFightBuffsID = 1204,1040,1035,1045,1062,1048,1036,1303,1085,1059,1078,264,267,268,304,349,273,276,365,1363
+
+# List of ID buffs - MAGE -
+buffCommandMageBuffsID = 1204,1068,1040,1035,1036,1045,1086,1077,1240,1242,264,267,268,269,304,364,271,274,275,1363

DATA:

<html><title>buff Command</title><body><center>

<br>
Slots de Buffs: <font color=LEVEL>%currentBuffs%</font> / %getMaxBuffs%
<br>
<table width=280>
<tr>
<td align=center><a action="bypass -h buffCommand 1040">Shield</a></td>
<td align=center><a action="bypass -h buffCommand 1062">Berserker</a></td>
<td align=center><a action="bypass -h buffCommand 271">Warrior</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1068">Might</a></td>
<td align=center><a action="bypass -h buffCommand 269">Hunter</a></td>
<td align=center><a action="bypass -h buffCommand 272">Inspiration</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1035">Mental Shield</a></td>

<td align=center><a action="bypass -h buffCommand 304">Vitality</a></td>
<td align=center><a action="bypass -h buffCommand 1355">P Of Water</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1077">Focus</a></td>
<td align=center><a action="bypass -h buffCommand 268">Wind</a></td>
<td align=center><a action="bypass -h buffCommand 1356">P Of Fire</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1078">Concentration</a></td>
<td align=center><a action="bypass -h buffCommand 265">Life</a></td>
<td align=center><a action="bypass -h buffCommand 1357">P Of Wind</a></td>
</tr>

<tr>
<td align=center><a action="bypass -h buffCommand 1085">Acumen</a></td>
<td align=center><a action="bypass -h buffCommand 363">Meditation</a></td>
<td align=center><a action="bypass -h buffCommand 1363">C Of Victory</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1036">Magic Barrier</a></td>
<td align=center><a action="bypass -h buffCommand 267">Warding</a></td>
<td align=center><a action="bypass -h buffCommand 1413">C Of Magnus'</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1045">Blessed Body</a></td>
<td align=center><a action="bypass -h buffCommand 270">Invocation</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1048">Blessed Soul</a></td>
<td align=center><a action="bypass -h buffCommand 266">Water</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1086">Haste</a></td>
<td align=center><a action="bypass -h buffCommand 264">Earth</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1204">Wind Walk</a></td>
<td align=center><a action="bypass -h buffCommand 277">Light</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1240">Guidance</a></td>
<td align=center><a action="bypass -h buffCommand 275">Fury</a></td>
<td align=center><a action="bypass -h cancelBuffs"><font color=LEVEL>Cancel Buffs</font></a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1303">Wild Magic</a></td>
<td align=center><a action="bypass -h buffCommand 274">Fire</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1059">Empower</a></td>
<td align=center><a action="bypass -h buffCommand 273">Mystic</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1087">Agility</a></td>
<td align=center><a action="bypass -h buffCommand 276">D Concentration</a></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommand 1268">Vampiric Rage</a></td>
<td align=center><a action="bypass -h buffCommand 365">Siren's</a></td>
</tr>
<tr>
<tr><td align=center><a action="bypass -h buffCommand 1242">Dead Whisper</a></td>
</tr>
</table>   

<br>
<center>
<table width=260>
<tr>
<td align=center><img src=icon.skill0214 width=32 height=32></td>
<td align=center><img src=icon.skill0430 width=32 height=32></td>
</tr>
<tr>
<td align=center><a action="bypass -h buffCommandMage"><font color=3399CC>Mage Buff</a></td>
<td align=center><a action="bypass -h buffCommandFight">Fight Buff</font></a></td>
</tr>
</table>
</center>
</body></html>

Creditos: Bluur
#85
L2 | Comandos / Comando .menu
Último mensaje por Swarlog - Jun 25, 2025, 09:46 PM

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>
#86
L2 | Comandos / Comando Send Donate
Último mensaje por Swarlog - Jun 25, 2025, 09:45 PM
### Eclipse Workspace Patch 1.0
#P L2jFanatic_GameServer
Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 26)
+++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -61,6 +61,7 @@
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRepairChar;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRes;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRideWyvern;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSendDonate;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminShop;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSiege;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSkill;
@@ -126,6 +127,7 @@
                registerAdminCommandHandler(new AdminRepairChar());
                registerAdminCommandHandler(new AdminRes());
                registerAdminCommandHandler(new AdminRideWyvern());
+               registerAdminCommandHandler(new AdminSendDonate());
                registerAdminCommandHandler(new AdminShop());
                registerAdminCommandHandler(new AdminSiege());
                registerAdminCommandHandler(new AdminSkill());
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java        (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java        (working copy)
@@ -0,0 +1,234 @@
+/*
+ * 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.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.idfactory.IdFactory;
+import net.sf.l2j.gameserver.model.L2ItemInstance.ItemLocation;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.templates.item.L2Item;
+import net.sf.l2j.gameserver.util.GMAudit;
+
+public class AdminSendDonate implements IAdminCommandHandler
+{
+       protected static final Logger _log = Logger.getLogger(AdminSendDonate.class.getName());
+     
+       private static final String[] ADMIN_COMMANDS =
+       {
+               "admin_senddonate",
+               "admin_givedonate"
+       };
+     
+       @Override
+       public boolean useAdminCommand(String command, L2PcInstance activeChar)
+       {
+               if (command.equals("admin_senddonate"))
+               {
+                       AdminHelpPage.showHelpPage(activeChar, "senddonate.htm");
+               }
+               else if (command.startsWith("admin_givedonate"))
+               {
+                       StringTokenizer st = new StringTokenizer(command, " ");
+                       st.nextToken();
+                     
+                       String playername = "";
+                       L2PcInstance player = null;
+                     
+                       if (st.countTokens() == 4)
+                       {
+                               playername = st.nextToken();
+                               player = L2World.getInstance().getPlayer(playername);
+                               String id = st.nextToken();
+                               int idval = Integer.parseInt(id);
+                               String num = st.nextToken();
+                               int numval = Integer.parseInt(num);
+                               String location = st.nextToken();
+                             
+                               // Can't use on yourself
+                               if (player != null && player.equals(activeChar))
+                               {
+                                       activeChar.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF);
+                                       return false;
+                               }
+                             
+                               if (player != null)
+                                       createItem(activeChar, player, idval, numval, getItemLocation(location));
+                               else
+                                       giveItemToOfflinePlayer(activeChar, playername, idval, numval, getItemLocation(location));
+                             
+                               auditAction(command, activeChar, playername);
+                       }
+                       else
+                       {
+                               activeChar.sendChatMessage(0, 0, "SYS", "Please fill in all the blanks before requesting a item creation.");
+                       }
+                     
+                       AdminHelpPage.showHelpPage(activeChar, "senddonate.htm");
+               }
+             
+               return true;
+       }
+     
+       /**
+        * Create item on player inventory. If player is offline, store item on database by giveItemToOfflinePlayer method.
+        * @param activeChar
+        * @param player
+        * @param id
+        * @param count
+        * @param location
+        */
+       private static void createItem(L2PcInstance activeChar, L2PcInstance player, int id, int count, ItemLocation location)
+       {
+               L2Item item = ItemTable.getInstance().getTemplate(id);
+               if (item == null)
+               {
+                       activeChar.sendChatMessage(0, 0, "SYS", "Unknown Item ID.");
+                       return;
+               }
+             
+               if (count > 10 && !item.isStackable())
+               {
+                       activeChar.sendChatMessage(0, 0, "SYS", "You can't to create more than 10 non stackable items!");
+                       return;
+               }
+             
+               if (location == ItemLocation.INVENTORY)
+                       player.getInventory().addItem("Admin", id, count, player, activeChar);
+               else if (location == ItemLocation.WAREHOUSE)
+                       player.getWarehouse().addItem("Admin", id, count, player, activeChar);
+             
+               if (activeChar != player)
+               {
+                       if (count > 1)
+                               player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S2_S1).addItemName(id).addNumber(count));
+                       else
+                               player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1).addItemName(id));
+               }
+             
+               activeChar.sendChatMessage(0, 0, "SYS", "Spawned " + count + " " + item.getName() + " in " + player.getName() + " " + (location == ItemLocation.INVENTORY ? "inventory" : "warehouse") + ".");
+       }
+     
+       /**
+        * If player is offline, store item by SQL Query
+        * @param activeChar
+        * @param playername
+        * @param id
+        * @param count
+        * @param location
+        */
+       private static void giveItemToOfflinePlayer(L2PcInstance activeChar, String playername, int id, int count, ItemLocation location)
+       {
+               L2Item item = ItemTable.getInstance().getTemplate(id);
+               int objectId = IdFactory.getInstance().getNextId();
+             
+               try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+               {
+                       PreparedStatement statement = con.prepareStatement("SELECT obj_Id FROM characters WHERE char_name=?");
+                       statement.setString(1, playername);
+                       ResultSet result = statement.executeQuery();
+                       int objId = 0;
+                     
+                       if (result.next())
+                       {
+                               objId = result.getInt(1);
+                       }
+                     
+                       result.close();
+                       statement.close();
+                     
+                       if (objId == 0)
+                       {
+                               activeChar.sendChatMessage(0, 0, "SYS", "Char \"" + playername + "\" does not exists!");
+                               con.close();
+                               return;
+                       }
+                     
+                       if (item == null)
+                       {
+                               activeChar.sendChatMessage(0, 0, "SYS", "Unknown Item ID.");
+                               return;
+                       }
+                     
+                       if (count > 1 && !item.isStackable())
+                       {
+                               activeChar.sendChatMessage(0, 0, "SYS", "You can't to create more than 1 non stackable items!");
+                               return;
+                       }
+                     
+                       statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
+                       statement.setInt(1, objId);
+                       statement.setInt(2, item.getItemId());
+                       statement.setInt(3, count);
+                       statement.setString(4, location.name());
+                       statement.setInt(5, 0);
+                       statement.setInt(6, 0);
+                       statement.setInt(7, objectId);
+                       statement.setInt(8, 0);
+                       statement.setInt(9, 0);
+                       statement.setInt(10, -1);
+                       statement.setLong(11, 0);
+                     
+                       statement.executeUpdate();
+                       statement.close();
+                     
+                       activeChar.sendChatMessage(0, 0, "SYS", "Created " + count + " " + item.getName() + " in " + playername + " " + (location == ItemLocation.INVENTORY ? "inventory" : "warehouse") + ".");
+                       _log.info("Insert item: (" + objId + ", " + item.getName() + ", " + count + ", " + objectId + ")");
+               }
+               catch (SQLException e)
+               {
+                       _log.log(Level.SEVERE, "Could not insert item " + item.getName() + " into DB: Reason: " + e.getMessage(), e);
+               }
+       }
+     
+       private static ItemLocation getItemLocation(String name)
+       {
+               ItemLocation location = null;
+               if (name.equalsIgnoreCase("inventory"))
+                       location = ItemLocation.INVENTORY;
+               else if (name.equalsIgnoreCase("warehouse"))
+                       location = ItemLocation.WAREHOUSE;
+               return location;
+       }
+     
+       private static void auditAction(String fullCommand, L2PcInstance activeChar, String target)
+       {
+               if (!Config.GMAUDIT)
+                       return;
+             
+               String[] command = fullCommand.split(" ");
+             
+               GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", command[0], (target.equals("") ? "no-target" : target), (command.length > 2 ? command[2] : ""));
+       }
+     
+       @Override
+       public String[] getAdminCommandList()
+       {
+               return ADMIN_COMMANDS;
+       }
+}
\ No newline at end of file
#P L2jFanatic_DataPack
Index: data/xml/admin_commands_rights.xml
===================================================================
--- data/xml/admin_commands_rights.xml  (revision 27)
+++ data/xml/admin_commands_rights.xml  (working copy)
@@ -300,6 +300,10 @@
        <aCar name="admin_ride" accessLevel="1" />
        <aCar name="admin_unride" accessLevel="1" />
 
+       <!-- SEND DONATE -->
+       <aCar name="admin_senddonate" accessLevel="1" />
+       <aCar name="admin_givedonate" accessLevel="1" />
+     
        <!-- SHOP -->
        <aCar name="admin_buy" accessLevel="1" />
        <aCar name="admin_gmshop" accessLevel="1" />
Index: data/html/admin/senddonate.htm
===================================================================
--- data/html/admin/senddonate.htm      (revision 0)
+++ data/html/admin/senddonate.htm      (working copy)
@@ -0,0 +1,23 @@
+<html><title>Donate</title><body>
+       <center>
+               <img src="Sek.cbui371" width=275 height=1>
+               <table width=275 bgcolor=000000>
+                       <tr>
+                               <td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
+                               <td width=180 align="center"><font color="LEVEL">Send Donate Menu</font></td>
+                               <td width=45><button value="Back" action="bypass -h admin_admin" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
+                       </tr>
+               </table>
+               <img src="Sek.cbui371" width=275 height=1><br>
+               <table width=280><tr><td>First fill the player's name. Then, fill in the ID number of the Item ID to create the item you want. Then fill in the quantity of the item you want to create in item count. Finally, choose where to create the item: in the warehouse or in the inventory.</td></tr></table><br>
+               <table width=240>
+                       <tr><td>Player Name:</td><td><edit var="playername" width=100></td></tr>
+                       <tr><td>Item ID:</td><td><edit var="itemid" width=100 type=number></td></tr>
+                       <tr><td>Item Count:</td><td><edit var="itemnum" width=100 type=number></td></tr>
+                       <tr><td>Location:</td><td><combobox width=100 height=17 var=location list=Warehouse;Inventory;></td></tr>
+               </table>
+               <br><br>
+               <button value="Send Donate" action="bypass -h admin_givedonate $playername $itemid $itemnum $location" width=95 height=21 back="bigbutton_over" fore="bigbutton"><br>
+               <table width=280><tr><td align="center"><font color="FF0000">Non-stackable items can't have amount superior to 10.</font></font></td></tr></table>
+       </center>
+</body></html>

Creditos: BlackZer0 por su publicación.
#87
L2 | Implementaciones / Item Class Commands
Último mensaje por Swarlog - Jun 25, 2025, 09:44 PM
CitarConfig.java

public static int STARTING_ADENA;

    public static int STARTING_AA;

   

    //Class Itmes On new Players\\

    +    public static boolean CLASS_ITEMS_ENABLE;

    +    public static int FIGHTER_ITEMS_PRICE;

    +    public static int MAGE_ITEMS_PRICE;
 
 
            STARTING_ADENA = Integer.parseInt(otherSettings.getProperty("StartingAdena", "100"));

            STARTING_AA = Integer.parseInt(otherSettings.getProperty("StartingAncientAdena", "0"));

            +                CLASS_ITEMS_ENABLE             = Boolean.parseBoolean(otherSettings.getProperty("ClassItemsCmd", "false"));

            +                FIGHTER_ITEMS_PRICE            = Integer.parseInt(otherSettings.getProperty("FighterItemsPirce", "50000000"));

            +                MAGE_ITEMS_PRICE            = Integer.parseInt(otherSettings.getProperty("MageItemsPirce", "50000000"));

Citarproperties

#Amount of adena/AA that a new character is given

StartingAdena = 0

StartingAncientAdena = 0

+

+#------------------------------------------------------------------

+# Class Items.

+# .daggeritems / .bowitems / .tankitems / .mageitems               

+#------------------------------------------------------------------

+ClassItemsCmd = false

+#

+FighterItemsPirce = 50000000

+#

+MageItemsPirce = 50000000

+

CitarVoicedCommandHandler.java

import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;

+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.ClassItem;
 
    private VoicedCommandHandler()

    {

        _datatable = new FastMap<>();

+     

+            if(Config.CLASS_ITEMS_ENABLE)

+                {

+                   registerVoicedCommandHandler(new ClassItems());

+                }       



CitarClassItem.java

/*
 * 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 com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
 
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
 
public class ClassItems implements IVoicedCommandHandler
{
        private static String[] _voicedCommands =
        {
                        "daggeritems", "bowitems", "tankitems", "mageitems"
        };
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
         *      com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
         */
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
            if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
            {
                        activeChar.sendMessage("You do not have enough Adena");
                        return false;
            }
            if(activeChar.isInOlympiadMode())
            {
                        activeChar.sendMessage("Sorry,you are in the Olympiad now.");
                        return false;
            }
            if(activeChar.isInDuel())
            {
                        activeChar.sendMessage("Sorry,you are in a duel!");
                        return false;
            }
            if(activeChar.atEvent)
            {
                        activeChar.sendMessage("Sorry,you are on event now.");
                        return false;
            }
            if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
            {
                        activeChar.sendMessage("Sorry,PK player can't use this.");
                        return false;
            }
            if(activeChar.isDead())
            {
                        activeChar.sendMessage("Sorry,Dead player can't take items.");                 
                        return false;
            }
            if(activeChar.isFakeDeath())
            {
                        activeChar.sendMessage("Sorry,on fake death mode can't use this.");
                        return false;
            }
            if(command.equalsIgnoreCase("daggeritems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("bowitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("tankitems"))
            {
                activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
            }
            else if (command.equalsIgnoreCase("mageitems"))
            {
                activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
                activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
                activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
                activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
                activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
            }
            return true;
        }
 
        /**
         * @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
         */
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
}
#88
L2 | Comandos / Comando .tradeoff
Último mensaje por Swarlog - Jun 25, 2025, 09:44 PM
CitarTradeOff.java

/*
 * 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 com.l2jfree.gameserver.handler.voicedcommandhandlers;

import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.SystemMessageId;
import com.l2jfree.gameserver.network.serverpackets.SystemMessage;

/**
 * @author Intrepid
 *
 */

public class TradeOff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"tradeoff",
"tradeon"
};

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if ((command.startsWith("tradeoff")))
{
if(activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already enabled!");
}
else
{
activeChar.setTradeRefusal(true);
activeChar.sendMessage("Trade refusal enabled");
}
}
if ((command.startsWith("tradeon")))
{
if(!activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already disabled!");
}
else
{
activeChar.setTradeRefusal(false);
activeChar.sendMessage("Trade refusal disabled");
}
}
return true;
}

public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}

By: Intrepid
#89
L2 | Comandos / Comando .pmoff
Último mensaje por Swarlog - Jun 25, 2025, 09:44 PM
Citarpmoff.java

/*
 * 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.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;

/**
 * @author Intrepid
 *
 */

public class pmoff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"pmoff"
};

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if ((command.startsWith("pmoff")))
{
if (activeChar.getMessageRefusal()) // already in message refusal mode
{
activeChar.setMessageRefusal(false);
activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
}
else
{
activeChar.setMessageRefusal(true);
activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
}
}
return true;
}

public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}

By: Intrepid
#90
L2 | Comandos / Comando .cl (Teleport Clan Lea...
Último mensaje por Swarlog - Jun 25, 2025, 09:43 PM
CitarCl.java

package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameTimeController;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding.EscapeFinalizer;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;

/**
 *
 *
 */
public class Cl implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "cl" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
       
        if (command.equalsIgnoreCase("cl"))
        {

           if (activeChar.getClan() == null)
              {
                 return false;
              }
       
            L2PcInstance leader;
            leader = (L2PcInstance)L2World.getInstance().findObject(activeChar.getClan().getLeaderId());

            if(leader == null)
            {
                activeChar.sendMessage("Your partner is not online.");
                return false;
            }
            else if(leader.isInJail())
            {
                activeChar.sendMessage("Your leader is in Jail.");
                return false;
            }
            else if(leader.isInOlympiadMode())
            {
                activeChar.sendMessage("Your leader is in the Olympiad now.");
                return false;
            }
            else if(leader.atEvent)
            {
                activeChar.sendMessage("Your leader is in an event.");
                return false;
            }
            else  if (leader.isInDuel())
            {
                activeChar.sendMessage("Your leader is in a duel.");
                return false;
            }
            else if (leader.isFestivalParticipant())
            {
                activeChar.sendMessage("Your leader is in a festival.");
                return false;
            }
            else if (leader.isInParty() && leader.getParty().isInDimensionalRift())
            {
                activeChar.sendMessage("Your leader is in dimensional rift.");
                return false;
            }
            else if (leader.inObserverMode())
            {
               activeChar.sendMessage("Your leader is in the observation.");
            }
            else if(leader.getClan() != null
                  && CastleManager.getInstance().getCastleByOwner(leader.getClan()) != null
                  && CastleManager.getInstance().getCastleByOwner(leader.getClan()).getSiege().getIsInProgress())
            {
               activeChar.sendMessage("Your leader is in siege, you can't go to your leader.");
               return false;
            }

            else if(activeChar.isInJail())
            {
                activeChar.sendMessage("You are in Jail!");
                return false;
            }
            else if(activeChar.isInOlympiadMode())
            {
                activeChar.sendMessage("You are in the Olympiad now.");
                return false;
            }
                    else if(activeChar._inEventVIP)
                     {
                          activeChar.sendPacket(SystemMessage.sendString("Your leader is in a VIP event."));
                        return false;
                     }
            else if(activeChar.atEvent)
            {
                activeChar.sendMessage("You are in an event.");
                return false;
            }
            else  if (activeChar.isInDuel())
            {
                activeChar.sendMessage("You are in a duel!");
                return false;
            }
            else if (activeChar.inObserverMode())
            {
               activeChar.sendMessage("You are in the observation.");
            }
            else if(activeChar.getClan() != null
                  && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null
                  && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress())
            {
               activeChar.sendMessage("You are in siege, you can't go to your leader.");
               return false;
            }
            else if (activeChar.isFestivalParticipant())
            {
                activeChar.sendMessage("You are in a festival.");
                return false;
            }
            else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
            {
                activeChar.sendMessage("You are in the dimensional rift.");
                return false;
            }
            else if (activeChar == leader)
            {
                activeChar.sendMessage("You cannot teleport to yourself.");
                return false;
            }
           if(activeChar.getInventory().getItemByItemId(3470) == null)
           {
              activeChar.sendMessage("You need one or more Gold Bars to use the cl-teleport system.");
             return false;
           }
               int leaderx;
               int leadery;
               int leaderz;
               
               leaderx = leader.getX();
               leadery = leader.getY();
               leaderz = leader.getZ();
               
               activeChar.teleToLocation(leaderx, leadery, leaderz);
     activeChar.sendMessage("You have been teleported to your leader!");
    activeChar.getInventory().destroyItemByItemId("RessSystem", 3470, 1, activeChar, activeChar.getTarget());
    activeChar.sendMessage("One GoldBar has dissapeared! Thank you!");
        }
        return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }

}

By: Vago