Noticias:

Menú Principal

Mensajes recientes

#91
L2 | Comandos / Comando .valakas
Último mensaje por Swarlog - Jun 25, 2025, 09:43 PM
Citarvoicedcommandhandlers/Valakas.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.instancemanager.SiegeManager;
import com.l2jfree.gameserver.instancemanager.ValakasManager;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.model.entity.Siege;
import com.l2jfree.gameserver.model.zone.L2Zone;

/**
 * @author Horus
 *
 */
public class Valakas implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{ "valakas" };

/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String)
*/
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String text)
{
if (command.startsWith("valakas"))
return valakas(activeChar);
return false;
}

/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
*/

private boolean valakas(L2PcInstance activeChar)
{
Siege siege = SiegeManager.getInstance().getSiege(activeChar);


if (activeChar.isTransformed())
{
activeChar.sendMessage("You can't teleport to valakas while transformed");
return false;
}
//check player is dead or using fake death and has his movement disabled
if (activeChar.isMovementDisabled() || activeChar.isAlikeDead())
{
activeChar.sendMessage("You can't teleport to valakas with fake death nor rooted");
return false;
}
// Check if the player is currently in Siege
if (siege != null && siege.getIsInProgress())
{
activeChar.sendMessage("You are in siege, cannot teleport to Valakas.");
return false;
}
// Check if the player is a Cursed Weapon owner
if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are currently holding a cursed weapon.");
return false;
}
// Check if the player is in Duel
if (activeChar.isInDuel())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are in a duel!");
return false;
}
//check if the player is in a DimensionalRift
if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are in the dimensional rift.");
return false;
}
// Check if the player is in an event
if (activeChar.isInFunEvent())
{
activeChar.sendMessage("You cannot teleport to Valakas since you are in an event.");
return false;
}
//check player is in Olympiad
if (activeChar.isInOlympiadMode() || activeChar.getOlympiadGameId() != -1)
{
activeChar.sendMessage("Teleporting to Valakas whilst in Olympiad isn't allowed.");
return false;
}
// Check if player is in observer mode
if (activeChar.inObserverMode())
{
activeChar.sendMessage("You cannot teleport to Valakas in Observer mode!");
return false;
}
//check player has karma/pk/pvp status
if (activeChar.getKarma() > 0 || activeChar.getPvpFlag() > 0)
{
activeChar.sendMessage("Flagged Players & Karma Players cannot use this command.");
return false;
}
//Check if player is immobilized
if (activeChar.isImmobilized())
{
activeChar.sendMessage("Immobilized players cannot use this command.");
return false;
}
if (!(activeChar.getAdena() >= 500000))
activeChar.sendMessage("You do not hold enough adena to teleport.");
// check if no one is targeted
if (activeChar.getTarget() == null)
ValakasManager.getInstance().Teleport(activeChar);
return true;
}


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

Citarinstancemanager/ValakasManager.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.instancemanager;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.l2jfree.Config;
import com.l2jfree.gameserver.ThreadPoolManager;
import com.l2jfree.gameserver.ai.CtrlIntention;
import com.l2jfree.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.serverpackets.SetupGauge;
import com.l2jfree.gameserver.network.serverpackets.SocialAction;

/**
 * @author Horus
 *
 */
public final class ValakasManager
{
private static final Log _log = LogFactory.getLog(ValakasManager.class.getName());
private static ValakasManager _instance;

public static final ValakasManager getInstance()
{
if (_instance == null)
{
_instance = new ValakasManager();
_log.info("ValakasManager: initialized.");
}
return _instance;
}



/**
* @param activeChar
* @param text
*/
public void Teleport(L2PcInstance activeChar)
{
activeChar.startAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
activeChar.sendMessage("You will be teleported in " + 120 + " Seconds.");
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
if(activeChar.isSitting())
{
activeChar.sendMessage("You cannot be sitting while teleporting to Valakas.");
return;
}
SetupGauge sg = new SetupGauge(SetupGauge.BLUE, 120 * 1000);
activeChar.sendPacket(sg);
activeChar.setIsImmobilized(true);
ThreadPoolManager.getInstance().scheduleGeneral(new PlayerTeleportTask(activeChar), 120 * 1000);
}

/**
* @param activeChar
*/


class PlayerTeleportTask implements Runnable
{

private final L2PcInstance _activeChar;

PlayerTeleportTask(L2PcInstance activeChar)
{
_activeChar = activeChar;
}

public void run()
{
if (_activeChar == null)
return;
if (_activeChar.isAttackingNow() || _activeChar.isCastingNow())
{
_activeChar.sendMessage("Cannot teleport if you are Casting or Attacking.");
return;
}
_activeChar.stopAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
_activeChar.getInventory().reduceAdena("ValakasManager", 500000, _activeChar, null);
_activeChar.setIsImmobilized(false);
_activeChar.teleToLocation(2138*** -115436, -1639);
_activeChar.sendMessage("You have successfully teleported to Valakas.");
_activeChar.sendMessage("horusicarus@gmail.com");
_log.info("ValakasManager: Player " + _activeChar.getName() + " was sucessfully ported.");

}
}

By: Horus
#92
L2 | Comandos / Comando .stat
Último mensaje por Swarlog - Jun 25, 2025, 09:42 PM
Citarstat.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 2, 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;


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

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
        if (command.equalsIgnoreCase("stat"))
        {
            if (activeChar.getTarget()==null)
            {
                activeChar.sendMessage("You have no one targeted.");
                return false;
            }
            if (!(activeChar.getTarget() instanceof L2PcInstance))
            {
                activeChar.sendMessage("You can only get the info of a player.");

                return false;
            }
               
            L2PcInstance targetp = (L2PcInstance)activeChar.getTarget();
 

           
           activeChar.sendMessage("========="+ targetp.getName() +"=========");
            activeChar.sendMessage("Level: " + targetp.getLevel());
            if (targetp.getClan() != null)
            {
               activeChar.sendMessage("Clan: " + targetp.getClan().getName());
               activeChar.sendMessage("Alliance: " + targetp.getClan().getAllyName());
            }
            else
            {
               activeChar.sendMessage("Alliance: None");
               activeChar.sendMessage("Clan: None");
            }
           
           
           
           
           
           
           activeChar.sendMessage("Adena: " + targetp.getAdena());
           
           
           
          if(activeChar.getInventory().getItemByItemId(6393) == null)
       {
          activeChar.sendMessage("Medals : 0");
       }
          else
          {
             activeChar.sendMessage("Medals : " + targetp.getInventory().getItemByItemId(6393).getCount());
          }
           
           
          if(activeChar.getInventory().getItemByItemId(3470) == null)
       {
          activeChar.sendMessage("Gold Bars : 0");
       }
          else
          {
             activeChar.sendMessage("Gold Bars : " + targetp.getInventory().getItemByItemId(3470).getCount());
          }
                 
           
           
            activeChar.sendMessage("PvP Kills: " + targetp.getPvpKills());
            activeChar.sendMessage("PvP Flags: " + targetp.getPvpFlag());
            activeChar.sendMessage("PK Kills: " + targetp.getPkKills());
            activeChar.sendMessage("HP, CP, MP: " + targetp.getMaxHp() + ", " +targetp.getMaxCp() + ", " + targetp.getMaxMp());
            activeChar.sendMessage("Wep Enchant: " + targetp.getInventory().getPaperdollItem(9).getEnchantLevel());
            activeChar.sendMessage("=========<L2 Pure>=========");

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

}

By: Vago
#93
L2 | Comandos / Command changepassword
Último mensaje por Swarlog - Jun 25, 2025, 09:42 PM
CitarCORE:

Index: java/com/l2jserver/gameserver/LoginServerThread.java
===================================================================
--- java/com/l2jserver/gameserver/LoginServerThread.java (revision 5708)
+++ java/com/l2jserver/gameserver/LoginServerThread.java (working copy)
@@ -45,6 +45,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.ChangePassword;
 import com.l2jserver.gameserver.network.gameserverpackets.PlayerAuthRequest;
 import com.l2jserver.gameserver.network.gameserverpackets.PlayerInGame;
 import com.l2jserver.gameserver.network.gameserverpackets.PlayerLogout;
@@ -55,6 +56,7 @@
 import com.l2jserver.gameserver.network.loginserverpackets.KickPlayer;
 import com.l2jserver.gameserver.network.loginserverpackets.LoginServerFail;
 import com.l2jserver.gameserver.network.loginserverpackets.PlayerAuthResponse;
+import com.l2jserver.gameserver.network.loginserverpackets.ChangePasswordResponse;
 import com.l2jserver.gameserver.network.serverpackets.CharSelectionInfo;
 import com.l2jserver.gameserver.network.serverpackets.LoginFail;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -334,6 +336,9 @@
  KickPlayer kp = new KickPlayer(decrypt);
  doKickPlayer(kp.getAccount());
  break;
+ case 0x06:
+ new ChangePasswordResponse(decrypt);
+ break;
  }
  }
  }
@@ -559,6 +564,20 @@
  }
  }
 
+ public void sendChangePassword(String accountName, String charName, String oldpass, String newpass)
+ {
+ ChangePassword cp = new ChangePassword(accountName, charName, oldpass, newpass);
+ try
+ {
+ sendPacket(cp);
+ }
+ catch (IOException e)
+ {
+ if (Config.DEBUG)
+ _log.log(Level.WARNING, "", e);
+ }
+ }
+
  /**
  * @return
  */
Index: java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java
===================================================================
--- java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (revision 0)
+++ java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (working copy)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+/**
+ * @author UnAfraid
+ */
+public class ChangePassword extends BaseSendablePacket
+{
+ public ChangePassword(String accountName, String characterName, String oldPass, String newPass)
+ {
+ writeC(0x0B);
+ writeS(accountName);
+ writeS(characterName);
+ writeS(oldPass);
+ writeS(newPass);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.java
===================================================================
--- java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0)
+++ java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.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 ChangePasswordResponse extends BaseRecievePacket
+{
+
+ public ChangePasswordResponse(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/GameServerThread.java
===================================================================
--- java/com/l2jserver/loginserver/GameServerThread.java (revision 5708)
+++ java/com/l2jserver/loginserver/GameServerThread.java (working copy)
@@ -33,6 +33,7 @@
 import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
 import com.l2jserver.loginserver.gameserverpackets.BlowFishKey;
 import com.l2jserver.loginserver.gameserverpackets.ChangeAccessLevel;
+import com.l2jserver.loginserver.gameserverpackets.ChangePassword;
 import com.l2jserver.loginserver.gameserverpackets.GameServerAuth;
 import com.l2jserver.loginserver.gameserverpackets.PlayerAuthRequest;
 import com.l2jserver.loginserver.gameserverpackets.PlayerInGame;
@@ -40,6 +41,7 @@
 import com.l2jserver.loginserver.gameserverpackets.PlayerTracert;
 import com.l2jserver.loginserver.gameserverpackets.ServerStatus;
 import com.l2jserver.loginserver.loginserverpackets.AuthResponse;
+import com.l2jserver.loginserver.loginserverpackets.ChangePasswordResponse;
 import com.l2jserver.loginserver.loginserverpackets.InitLS;
 import com.l2jserver.loginserver.loginserverpackets.KickPlayer;
 import com.l2jserver.loginserver.loginserverpackets.LoginServerFail;
@@ -166,6 +168,9 @@
  case 07:
  onReceivePlayerTracert(data);
  break;
+ case 0x0B:
+ new ChangePassword(data);
+ break;
  default:
  _log.warning("Unknown Opcode ("+Integer.toHexString(packetType).toUpperCase()+") from GameServer, closing connection.");
  forceClose(LoginServerFail.NOT_AUTHED);
@@ -658,6 +663,20 @@
  }
  }
 
+ public void ChangePasswordResponse(byte successful, String characterName, String msgToSend)
+ {
+ ChangePasswordResponse cp = new ChangePasswordResponse(successful, characterName, msgToSend);
+ try
+ {
+ sendPacket(cp);
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
  /**
  * @param gameHost The gameHost to set.
  */
Index: java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java
===================================================================
--- java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java (revision 0)
+++ java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java (working copy)
@@ -0,0 +1,131 @@
+/*
+ * 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.gameserverpackets;
+
+import java.security.MessageDigest;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+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.Base64;
+import com.l2jserver.util.network.BaseRecievePacket;
+
+/**
+ * @author Nik
+ */
+public class ChangePassword extends BaseRecievePacket
+{
+ protected static Logger _log = Logger.getLogger(ChangePassword.class.getName());
+ private static GameServerThread gst = null;
+
+ public ChangePassword(byte[] decrypt)
+ {
+ super(decrypt);
+
+ String accountName = readS();
+ String characterName = readS();
+ String curpass = readS();
+ String newpass = 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 ((curpass == null) || (newpass == null))
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "Invalid password data! Try again.");
+ }
+ else
+ {
+ Connection con = null;
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+
+ byte[] raw = curpass.getBytes("UTF-8");
+ raw = md.digest(raw);
+ String curpassEnc = Base64.encodeBytes(raw);
+ String pass = null;
+ int passUpdated = 0;
+
+ // SQL connection
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
+ statement.setString(1, accountName);
+ ResultSet rset = statement.executeQuery();
+ if (rset.next())
+ {
+ pass = rset.getString("password");
+ }
+ rset.close();
+ statement.close();
+
+ if (curpassEnc.equals(pass))
+ {
+ byte[] password = newpass.getBytes("UTF-8");
+ password = md.digest(password);
+
+ // SQL connection
+ PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
+ ps.setString(1, Base64.encodeBytes(password));
+ ps.setString(2, accountName);
+ passUpdated = ps.executeUpdate();
+ ps.close();
+
+ _log.log(Level.INFO, "The password for account " + accountName + " has been changed from " + curpassEnc + " to " + Base64.encodeBytes(password));
+ if (passUpdated > 0)
+ {
+ gst.ChangePasswordResponse((byte) 1, characterName, "You have successfully changed your password!");
+ }
+ else
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "The password change was unsuccessful!");
+ }
+ }
+ else
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "The typed current password doesn't match with your current one.");
+ }
+ }
+ catch (Exception e)
+ {
+ _log.warning("Error while changing password for account " + accountName + " requested by player " + characterName + "! " + e);
+ }
+ finally
+ {
+ // close the database connection at the end
+ L2DatabaseFactory.close(con);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.java
===================================================================
--- java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.java (revision 0)
+++ java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.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.loginserver.loginserverpackets;
+
+import com.l2jserver.util.network.BaseSendablePacket;
+
+/**
+ * @author Nik
+ */
+public class ChangePasswordResponse extends BaseSendablePacket
+{
+ public ChangePasswordResponse(byte successful, String characterName, String msgToSend)
+ {
+ writeC(0x06);
+ // writeC(successful); //0 false, 1 true
+ writeS(characterName);
+ writeS(msgToSend);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
\ No newline at end of file

CitarDATA:

Index: dist/game/data/html/mods/ChangePassword.htm
===================================================================
--- dist/game/data/html/mods/ChangePassword.htm (revision 0)
+++ dist/game/data/html/mods/ChangePassword.htm (working copy)
@@ -0,0 +1,10 @@
+<html><body>
+<center>
+<td>
+<tr>Current Password:</tr><tr><edit type="password" var="oldpass" width=150></tr><br>
+<tr>New Password</tr><tr><edit type="password" var="newpass" width=150></tr><br>
+<tr>Repeat New Password</tr><tr><edit type="password" var="repeatnewpass" width=150></tr><br>
+<td>
+<button value="Change Password" action="bypass -h voice .changepassword $oldpass $newpass $repeatnewpass" width=160 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
+</center>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9149)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -240,6 +240,7 @@
 import handlers.usercommandhandlers.PartyInfo;
 import handlers.usercommandhandlers.Time;
 import handlers.voicedcommandhandlers.Banking;
+import handlers.voicedcommandhandlers.ChangePassword;
 import handlers.voicedcommandhandlers.ChatAdmin;
 import handlers.voicedcommandhandlers.Debug;
 import handlers.voicedcommandhandlers.Lang;
@@ -548,6 +549,7 @@
  VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Lang());
  if (Config.L2JMOD_DEBUG_VOICE_COMMAND)
  VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Debug());
+ VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new ChangePassword());
  _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers");
  }
 
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java (working copy)
@@ -0,0 +1,99 @@
+/*
+ * 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;
+
+
+/**
+ *
+ * @author Nik
+ *
+ */
+public class ChangePassword implements IVoicedCommandHandler
+{
+        private static final String[] _voicedCommands =
+        {
+                "changepassword"
+        };
+       
+        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+        {
+                if (target != null)
+                {
+                        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 password doesn't match with the repeated one!");
+                                                return false;
+                                        }
+                                        if (newpass.length() < 3)
+                                        {
+                                                activeChar.sendMessage("The new password is shorter than 3 chars! Please try with a longer one.");
+                                                return false;
+                                        }
+                                        if (newpass.length() > 30)
+                                        {
+                                                activeChar.sendMessage("The new password is longer than 30 chars! Please try with a shorter one.");
+                                                return false;
+                                        }
+                                   
+                                        LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass);
+                                }
+                                else
+                                {
+                                        activeChar.sendMessage("Invalid password data! You have to fill all boxes.");
+                                        return false;
+                                }
+                        }
+                        catch (Exception e)
+                        {
+                                activeChar.sendMessage("A problem occured while changing password!");
+                                _log.log(Level.WARNING, "", e);
+                        }
+                }
+                else
+                {
+                        //showHTML(activeChar);
+                        String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangePassword.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(1, html));
+                        return true;
+                }
+                return true;
+        }
+
+        public String[] getVoicedCommandList()
+        {
+                return _voicedCommands;
+        }
+}
\ No newline at end of file

Original Author(s): Nik & UnAfraid

CitarADAPTACIÓN:

Para liberar lag del servidor. Añadido tiempo de reuso del comando para editar contraseña de la cuenta.

diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java b/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
index f31bf55..ced0f5a 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
@@ -18,7 +18,9 @@
  */
 package handlers.voicedcommandhandlers;
 
+import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Level;
 
 import com.l2jserver.gameserver.LoginServerThread;
@@ -32,6 +34,8 @@
  */
 public class ChangePassword implements IVoicedCommandHandler
 {
+ private static final Map<Integer, Long> REUSES = new ConcurrentHashMap<>();
+ private static final int REUSE = 30 * 60 * 1000; // 30 Min
  private static final String[] _voicedCommands =
  {
  "changepassword"
@@ -77,6 +81,13 @@
  return false;
  }
 
+ final Long timeStamp = REUSES.get(activeChar.getObjectId());
+ if ((timeStamp != null) && ((System.currentTimeMillis() - REUSE) < timeStamp.longValue()))
+ {
+ activeChar.sendMessage("You cannot change the password so often!");
+ return false;
+ }
+ REUSES.put(activeChar.getObjectId(), System.currentTimeMillis());
  LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass);
  }
  else
#94
L2 | Comandos / Comando .menu (Pack)
Último mensaje por Swarlog - Jun 25, 2025, 09:42 PM
### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java    (working copy)
@@ -156,7 +156,8 @@
 
         // Pet uses the power of spirit.
         activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_USE_THE_POWER_OF_SPIRIT));
-        Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, 2033, 1, 0, 0), 360000/*600*/);
+        if (!activeOwner.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, 2033, 1, 0, 0), 360000/*600*/);
 
         activeOwner = null;
         activePet = null;
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java    (working copy)
@@ -92,7 +92,8 @@
         //activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SPIRITSHOT));
 
         MagicSkillUser MSU = new MagicSkillUser(activeChar, SKILL_IDS[grade], 1, 0, 0);
-        Broadcast.toSelfAndKnownPlayers(activeChar, MSU);
+        if (!activeChar.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayers(activeChar, MSU);
         MSU = null;
         activeChar.setTarget(oldTarget);
 
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -20222,4 +20222,60 @@
         }
         sendSkillList();
     }
+   
+    private boolean _cantGainXP = false;
+    private boolean _isPartyInvProt = false;
+    private boolean _isInTradeProt = false;
+    private boolean _isSSDisabled = false;
+    private boolean _isInRefusal = false;
+   
+    public boolean isInTradeProt()
+    {
+        return _isInTradeProt;
+    }
+   
+    public void setIsInTradeProt(boolean value)
+    {
+        _isInTradeProt = value;
+    }
+   
+    public boolean isSSDisabled()
+    {
+        return _isSSDisabled;
+    }
+   
+    public void setIsSSDisabled(boolean value)
+    {
+        _isSSDisabled = value;
+    }
+   
+    public boolean isPartyInvProt()
+    {
+        return _isPartyInvProt;
+    }
+   
+    public void setIsPartyInvProt(boolean value)
+    {
+        _isPartyInvProt = value;
+    }
+   
+    public void cantGainXP(boolean b)
+    {
+        _cantGainXP = b;
+    }
+   
+    public boolean cantGainXP()
+    {
+        return _cantGainXP;
+    }
+   
+    public void setInRefusalMode(boolean b)
+    {
+        _isInRefusal = b;
+    }
+   
+    public boolean isInRefusalMode()
+    {
+        return _isInRefusal;
+    }
 }
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java    (working copy)
@@ -78,6 +78,12 @@
             return;
         }
        
+        if (target.isPartyInvProt())
+        {
+            requestor.sendMessage("You can't invite that player because he is in party protection.");
+            return;
+        }
+       
         if (target.isInParty())
         {
             SystemMessage msg = new SystemMessage(SystemMessageId.S1_IS_ALREADY_IN_PARTY);
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java    (working copy)
@@ -137,7 +137,8 @@
 
         // Send message to client
         activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
-        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+        if (!activeChar.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
 
         activeChar = null;
         weaponInst = null;
Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java    (working copy)
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Menu;


+registerVoicedCommandHandler( new Menu());

if (Config.BANKING_SYSTEM_ENABLED)
Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java    (revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java    (revision 0)
@@ -0,0 +1,173 @@
/*
 * 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 javolution.text.TextBuilder;

import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;

public class Menu implements IVoicedCommandHandler
{
                   private final String[] _voicedCommands =
                   {
                           "menu"
                   };
     
       @Override
       public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
       {
               mainHtml(activeChar);
               return true;
       }
     
       public static void mainHtml(L2PcInstance activeChar)
       {
               NpcHtmlMessage nhm = new NpcHtmlMessage(5);
               TextBuilder tb = new TextBuilder("");
             
               tb.append("<html><head><title>Personal Menu</title></head><body>");
               tb.append("<center>");
               tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
               tb.append("<td valign=\"top\">Players online <font color=\"FF6600\"> "+L2World.getInstance().getAllPlayers().size()+"</font>"); 
               tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, use this menu for everything related to your gameplay.<br1></td>");
               tb.append("</tr>");
               tb.append("</table>");
               tb.append("</center>");
               tb.append("<center>");
               tb.append("<table border=\"1\" width=\"100\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td width=\"52\">ON</td>");
               tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
               tb.append("</tr>");
               tb.append("<tr>");
               tb.append("<td width=\"52\">OFF</td>");
               tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
               tb.append("</tr>");
               tb.append("</table><br>");
               tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td align=\"center\" width=\"52\">Buff Protection</td>");
               if(activeChar.isBuffProtected())
               tb.append("<td width=\"16\"><button action=\"bypass -h buffprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               if(!activeChar.isBuffProtected())
               tb.append("<td width=\"16\"><button action=\"bypass -h buffprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("</tr>");
               tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY buff from another character.</font></td></tr>");
               tb.append("</table>");
                              tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
                              tb.append("<tr>");
                              tb.append("<td align=\"center\" width=\"52\">Personal Message Refusal</td>");
                              if(activeChar.getMessageRefusal())
                              tb.append("<td width=\"16\"><button action=\"bypass -h pmref\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
                              if(!activeChar.getMessageRefusal())
                              tb.append("<td width=\"16\"><button action=\"bypass -h pmref\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
                              tb.append("</tr>");
                              tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY pm from another character.</font></td></tr>");
                              tb.append("</table>");
                              tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
                              tb.append("<tr>");
               tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td align=\"center\" width=\"52\">Trade Request Protection</td>");
               if(activeChar.isInTradeProt())
               tb.append("<td width=\"16\"><button action=\"bypass -h tradeprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               if(!activeChar.isInTradeProt())
               tb.append("<td width=\"16\"><button action=\"bypass -h tradeprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("</tr>");
               tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY trade request from another character.</font></td></tr>");
               tb.append("</table>");
               tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td align=\"center\" width=\"52\">Soulshot/Spiritshot Effect</td>");
               if(activeChar.isSSDisabled())
               tb.append("<td width=\"16\"><button action=\"bypass -h ssprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               if(!activeChar.isSSDisabled())
               tb.append("<td width=\"16\"><button action=\"bypass -h ssprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("</tr>");
               tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you will enchance your pc's performance by disabling your ss effects.</font></td><td align=\"center\" valign=\"middle\"><button action=\"bypass -h page2\" width=16 height=16 back=\"L2UI_CH3.next1\" fore=\"L2UI_CH3.next1\"></td></tr>");
               tb.append("</table>");
             
               tb.append("</center>");
               tb.append("</body></html>");
             
               nhm.setHtml(tb.toString());
               activeChar.sendPacket(nhm);
       }
     
       public static void mainHtml2(L2PcInstance activeChar)
       {
               NpcHtmlMessage nhm = new NpcHtmlMessage(5);
               TextBuilder tb = new TextBuilder("");
             
               tb.append("<html><head><title>Personal Menu</title></head><body>");
               tb.append("<center>");
               tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
               tb.append("<td valign=\"top\">Players online <font color=\"FF6600\"> "+L2World.getInstance().getAllPlayers().size()+"</font>");
               tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, use this menu for everything related to your gameplay.<br1></td>");
               tb.append("</tr>");
               tb.append("</table>");
               tb.append("</center>");
               tb.append("<center>");
               tb.append("<table border=\"1\" width=\"100\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td width=\"52\">ON</td>");
               tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
               tb.append("</tr>");
               tb.append("<tr>");
               tb.append("<td width=\"52\">OFF</td>");
               tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
               tb.append("</tr>");
               tb.append("</table><br>");
               tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td align=\"center\" width=\"52\">Party Invite Protection</td>");
               if(activeChar.isPartyInvProt())
               tb.append("<td width=\"16\"><button action=\"bypass -h partyin\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               if(!activeChar.isPartyInvProt())
               tb.append("<td width=\"16\"><button action=\"bypass -h partyin\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("</tr>");
               tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY party invite from another character.</font></td></tr>");
               tb.append("</table>");
               tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
               tb.append("<tr>");
               tb.append("<td align=\"center\" width=\"52\">Exp Gain Protection</td>");
               if(activeChar.cantGainXP())
               tb.append("<td width=\"16\"><button action=\"bypass -h xpnot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
               if(!activeChar.cantGainXP())
               tb.append("<td width=\"16\"><button action=\"bypass -h xpnot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
               tb.append("</tr>");
               tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve expirience from killing monsters.</font></td><td align=\"center\" valign=\"middle\"><button action=\"bypass -h page1\" width=16 height=16 back=\"L2UI_CH3.back1\" fore=\"L2UI_CH3.next1\"></td></tr>");
               tb.append("</table>");
               tb.append("</center>");
               tb.append("</body></html>");
             
               nhm.setHtml(tb.toString());
               activeChar.sendPacket(nhm);
       }
     
       @Override
       public String[] getVoicedCommandList()
       {
               return _voicedCommands;
       }
}
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java    (working copy)
@@ -128,7 +128,8 @@
 
         // Send message to client
         activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
-        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+        if (!activeChar.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
 
         activeChar = null;
     }
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java    (working copy)
@@ -202,7 +202,13 @@
             player.sendPacket(new SystemMessage(SystemMessageId.TARGET_TOO_FAR));
             return;
         }
-
+       
+        if (partner.isInTradeProt())
+        {
+            player.sendMessage(partner.getName() + " is in Trade Protection Mode");
+            return;
+        }
+       
         // Alt game - Karma punishment
         if(!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || partner.getKarma() > 0))
         {
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java    (working copy)
@@ -142,7 +142,8 @@
 
         // Send message to client
         activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SOULSHOT));
-        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+        if (!activeChar.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
 
         activeChar = null;
     }
Index: head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java    (working copy)
@@ -58,6 +58,9 @@
         //Player is Gm and access level is below or equal to canGainExp and is in party, don't give Xp
         if(!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty())
             return false;
+       
+        if (activeChar.cantGainXP())
+            return false;
 
         if(!super.addExp(value))
             return false;
@@ -111,6 +114,9 @@
         L2PcInstance activeChar = getActiveChar();
         if(!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty())
             return false;
+       
+        if (activeChar.cantGainXP())
+            return false;
 
         // if this player has a pet that takes from the owner's Exp, give the pet Exp now
 
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java    (working copy)
@@ -28,6 +28,7 @@
 import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
 import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
 import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Menu;
 import com.l2jfrozen.gameserver.model.L2Object;
 import com.l2jfrozen.gameserver.model.L2World;
 import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
@@ -41,8 +42,10 @@
 import com.l2jfrozen.gameserver.model.entity.event.TvT;
 import com.l2jfrozen.gameserver.model.entity.event.VIP;
 import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
 import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
 import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
 import com.l2jfrozen.gameserver.util.GMAudit;
 
 public final class RequestBypassToServer extends L2GameClientPacket
@@ -308,7 +311,90 @@
                     player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
                 }
             }
-
                    +     else if (_command.startsWith("page1"))
                    +            Menu.mainHtml(activeChar);
                    +        else if (_command.startsWith("buffprot"))
                    +        {
                    +            if (activeChar.isBuffProtected())
                    +            {
                    +                +activeChar.setIsBuffProtected(false);
                    +                +activeChar.sendMessage("Buff protection is disabled.");
                    +                +Menu.mainHtml(activeChar);
                    +            }
                    +            else
                    +            {
                    +                activeChar.setIsBuffProtected(true);
                    +                activeChar.sendMessage("Buff protection is enabled.");
                    +                Menu.mainHtml(activeChar);
                    +            }
                    +        }
                    +        else if (_command.startsWith("tradeprot"))
                    +        {
                    +            if (activeChar.isInTradeProt())
                    +            {
                    +                +activeChar.setIsInTradeProt(false);
                    +                +activeChar.sendMessage("Trade acceptance mode is enabled.");
                    +                +Menu.mainHtml(activeChar);
                    +            }
                    +            else
                    +            {
                    +                activeChar.setIsInTradeProt(true);
                    +                activeChar.sendMessage("Trade refusal mode is enabled.");
                    +                Menu.mainHtml(activeChar);
                    +            }
                    +        }
                    +        else if (_command.startsWith("ssprot"))
                    +        {
                    +            if (activeChar.isSSDisabled())
                    +            {
                    +                activeChar.setIsSSDisabled(false);
                    +                activeChar.sendMessage("Soulshots effects are enabled.");
                    +                Menu.mainHtml(activeChar);
                    +            }
                    +            else
                    +            {
                    +                activeChar.setIsSSDisabled(true);
                    +                activeChar.sendMessage("Soulshots effects are disabled.");
                    +                Menu.mainHtml(activeChar);
                    +            }
                    +        }
                    +        else if (_command.startsWith("xpnot"))
                    +        {
                    +            if (activeChar.cantGainXP())
                    +            {
                    +                activeChar.cantGainXP(false);
                    +                activeChar.sendMessage("Enable Xp");
                    +                Menu.mainHtml2(activeChar);
                    +            }
                    +            else
                    +            {
                    +                activeChar.cantGainXP(true);
                    +                activeChar.sendMessage("Disable Xp");
                    +                Menu.mainHtml2(activeChar);
                    +            }
                    +        }
                    +        else if (_command.startsWith("pmref"))
        +    {
        +                        if (activeChar.getMessageRefusal())   
        +                        {
        +        activeChar.setMessageRefusal(false);
        +        activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
        +        Menu.mainHtml(activeChar);
        +    }
        +    else
        +    {
        +        activeChar.setMessageRefusal(true);
        +        activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
        +        Menu.mainHtml(activeChar);
        +    }
        +    }
        +                    else if (_command.startsWith("partyin"))
        +                    {
        +                        if (activeChar.isPartyInvProt())
        +                        {
        +                            activeChar.setIsPartyInvProt(false);
        +                            activeChar.sendMessage("Party acceptance mode is enabled.");
        +                            Menu.mainHtml2(activeChar);
        +                        }
        +                        else
        +                        {
        +                            activeChar.setIsPartyInvProt(true);
        +                            activeChar.sendMessage("Party refusal mode is enabled.");
        +                            Menu.mainHtml2(activeChar);
        +                        }
        +                    }
        +                    else if (_command.startsWith("page2"))
        +                        Menu.mainHtml2(activeChar);
             // Jstar's Custom Bypass Caller!
             else if(_command.startsWith("custom_"))
             {
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java    (working copy)
@@ -169,7 +169,8 @@
 
         // Pet uses the power of spirit.
         activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_USE_THE_POWER_OF_SPIRIT));
-        Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, isBlessed ? 2009 : 2008, 1, 0, 0), 360000/*600*/);
+        if (!activeOwner.isSSDisabled())
+            Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, isBlessed ? 2009 : 2008, 1, 0, 0), 360000/*600*/);
 
         activeOwner = null;
         activePet = null;
Index: head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java    (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java    (working copy)
@@ -143,7 +143,16 @@
                     || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
                     || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
                     || skill.getSkillType() == L2Skill.SkillType.REFLECT))
-                    continue;
+                continue;
+           
+            if (activeChar instanceof L2PcInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
+                && (skill.getSkillType() == L2Skill.SkillType.BUFF
+                || skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT
+                || skill.getSkillType() == L2Skill.SkillType.FORCE_BUFF
+                || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
+                || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
+                || skill.getSkillType() == L2Skill.SkillType.REFLECT))
+                continue;
            
             // Player holding a cursed weapon can't be buffed and can't buff
             if(skill.getSkillType() == L2Skill.SkillType.BUFF)
^-^
#95
L2 | Comandos / Comando Activar/Desactivar Tra...
Último mensaje por Swarlog - Jun 25, 2025, 09:41 PM
gameserver/handler/voicedcommandhandlers/TradeOff.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;
}
}

gameserver/handler/VoicedCommandHandler.java

registerVoicedCommandHandler(new CastleDoors());
registerVoicedCommandHandler(new Hellbound());
registerVoicedCommandHandler(new Banking());
+ registerVoicedCommandHandler(new TradeOff());
#96
L2 | Comandos / Comando Activar/Desactivar MP
Último mensaje por Swarlog - Jun 25, 2025, 09:41 PM
gameserver/handler/voicedcommandhandlers/pmoff.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;
}
}

gameserver/handler/VoicedCommandHandler.java

registerVoicedCommandHandler(new CastleDoors());
registerVoicedCommandHandler(new Hellbound());
registerVoicedCommandHandler(new Banking());
+ registerVoicedCommandHandler(new pmoff());
#97
L2 | Comandos / Clan Info and edit commands
Último mensaje por Swarlog - Jun 25, 2025, 09:41 PM
Index: sql/admin_command_access_rights.sql
===================================================================
--- sql/admin_command_access_rights.sql (revision 41)
+++ sql/admin_command_access_rights.sql (working copy)
@@ -573,4 +573,8 @@
 -- voice commands
 ('banchat','7'),
 ('unbanchat','7'),
-('debug','1');
\ No newline at end of file
+('debug','1'),
+
+-- admin clan info
+('admin_clan_info', '1'),
+('admin_clan_changeleader', '127');
\ No newline at end of file
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java (revision 41)
+++ data/scripts/handlers/MasterHandler.java (working copy)
@@ -38,6 +38,7 @@
 import handlers.admincommandhandlers.AdminCache;
 import handlers.admincommandhandlers.AdminCamera;
 import handlers.admincommandhandlers.AdminChangeAccessLevel;
+import handlers.admincommandhandlers.AdminClan;
 import handlers.admincommandhandlers.AdminCreateItem;
 import handlers.admincommandhandlers.AdminCursedWeapons;
 import handlers.admincommandhandlers.AdminDebug;
@@ -297,6 +298,7 @@
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCache());
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCamera());
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminChangeAccessLevel());
+ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminClan());
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCreateItem());
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCursedWeapons());
  AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminDebug());
Index: data/scripts/handlers/admincommandhandlers/AdminEditChar.java
===================================================================
--- data/scripts/handlers/admincommandhandlers/AdminEditChar.java (revision 41)
+++ data/scripts/handlers/admincommandhandlers/AdminEditChar.java (working copy)
@@ -34,7 +34,6 @@
 import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
 import com.l2jserver.gameserver.datatables.CharNameTable;
 import com.l2jserver.gameserver.datatables.CharTemplateTable;
-import com.l2jserver.gameserver.datatables.ClanTable;
 import com.l2jserver.gameserver.handler.IAdminCommandHandler;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2World;
@@ -831,7 +830,7 @@
  adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/" + filename);
  adminReply.replace("%name%", player.getName());
  adminReply.replace("%level%", String.valueOf(player.getLevel()));
- adminReply.replace("%clan%", String.valueOf(ClanTable.getInstance().getClan(player.getClanId())));
+ adminReply.replace("%clan%", String.valueOf(player.getClan() != null ? "<a action=\"bypass -h admin_clan_info " + player.getObjectId() + "\">" + player.getClan().getName() + "</a>" : null));
  adminReply.replace("%xp%", String.valueOf(player.getExp()));
  adminReply.replace("%sp%", String.valueOf(player.getSp()));
  adminReply.replace("%class%", player.getTemplate().className);
Index: data/scripts/handlers/admincommandhandlers/AdminClan.java
===================================================================
--- data/scripts/handlers/admincommandhandlers/AdminClan.java (revision 0)
+++ data/scripts/handlers/admincommandhandlers/AdminClan.java (revision 0)
@@ -0,0 +1,184 @@
+/*
+ * 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.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.handler.IAdminCommandHandler;
+import com.l2jserver.gameserver.instancemanager.CastleManager;
+import com.l2jserver.gameserver.instancemanager.ClanHallManager;
+import com.l2jserver.gameserver.instancemanager.FortManager;
+import com.l2jserver.gameserver.instancemanager.SiegeManager;
+import com.l2jserver.gameserver.model.L2Clan;
+import com.l2jserver.gameserver.model.L2ClanMember;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
+import com.l2jserver.gameserver.network.communityserver.writepackets.WorldInfo;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * @author ThE_PuNiSHeR a.k.a UnAfraid
+ */
+public class AdminClan implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_clan_info",
+ "admin_clan_changeleader"
+ };
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ StringTokenizer st = new StringTokenizer(command, " ");
+ String cmd = st.nextToken();
+ if (cmd.startsWith("admin_clan_info"))
+ {
+ try
+ {
+ int objectId = Integer.parseInt(st.nextToken());
+ L2PcInstance player = L2World.getInstance().getPlayer(objectId);
+ if (player != null)
+ {
+ L2Clan clan = player.getClan();
+ if (clan != null)
+ {
+ try
+ {
+ NpcHtmlMessage msg = new NpcHtmlMessage(0);
+ String htm = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/claninfo.htm");
+ msg.setHtml(htm.toString());
+ msg.replace("%clan_name%", clan.getName());
+ msg.replace("%clan_leader%", clan.getLeaderName());
+ msg.replace("%clan_level%", String.valueOf(clan.getLevel()));
+ msg.replace("%clan_has_castle%", clan.getHasCastle() > 0 ? CastleManager.getInstance().getCastleById(clan.getHasCastle()).getName() : "No");
+ msg.replace("%clan_has_clanhall%", clan.getHasHideout() > 0 ? ClanHallManager.getInstance().getClanHallById(clan.getHasHideout()).getName() : "No");
+ msg.replace("%clan_has_fortress%", clan.getHasFort() > 0 ? FortManager.getInstance().getFortById(clan.getHasFort()).getName() : "No");
+ msg.replace("%clan_points%", String.valueOf(clan.getReputationScore()));
+ msg.replace("%clan_players_count%", String.valueOf(clan.getMembersCount()));
+ msg.replace("%clan_ally%", clan.getAllyId() > 0 ? clan.getAllyName() : "Not in ally");
+ msg.replace("%current_player_objectId%", String.valueOf(objectId));
+ msg.replace("%current_player_name%", player.getName());
+ activeChar.sendPacket(msg);
+
+ }
+ catch (NullPointerException npe)
+ {
+ npe.printStackTrace();
+ }
+
+ }
+ else
+ {
+ activeChar.sendMessage("Clan not found.");
+ return false;
+ }
+ }
+ else
+ {
+ activeChar.sendMessage("Player is offline!");
+ return false;
+ }
+ }
+ catch (NumberFormatException nfe)
+ {
+ activeChar.sendMessage("This shouldn't happening");
+ return false;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else if (cmd.startsWith("admin_clan_changeleader"))
+ {
+ try
+ {
+ int objectId = Integer.parseInt(st.nextToken());
+
+ L2PcInstance player = L2World.getInstance().getPlayer(objectId);
+ if (player != null)
+ {
+ L2Clan clan = player.getClan();
+ if (clan == null)
+ {
+ activeChar.sendMessage("Player don't have clan");
+ return false;
+ }
+ for (L2ClanMember member : clan.getMembers())
+ {
+ if (member.getObjectId() == player.getObjectId())
+ {
+ L2PcInstance exLeader = clan.getLeader().getPlayerInstance();
+ if (exLeader != null)
+ {
+ SiegeManager.getInstance().removeSiegeSkills(exLeader);
+ exLeader.setClan(clan);
+ exLeader.setClanPrivileges(L2Clan.CP_NOTHING);
+ exLeader.broadcastUserInfo();
+ exLeader.setPledgeClass(exLeader.getClan().getClanMember(exLeader.getObjectId()).calculatePledgeClass(exLeader));
+ exLeader.broadcastUserInfo();
+ exLeader.checkItemRestriction();
+ }
+ else
+ {
+ // TODO: with query?
+ }
+
+ clan.setLeader(member);
+ clan.updateClanInDB();
+
+ L2PcInstance newLeader = member.getPlayerInstance();
+ newLeader.setClan(clan);
+ newLeader.setPledgeClass(member.calculatePledgeClass(newLeader));
+ newLeader.setClanPrivileges(L2Clan.CP_ALL);
+
+ if (clan.getLevel() >= SiegeManager.getInstance().getSiegeClanMinLevel())
+ SiegeManager.getInstance().addSiegeSkills(newLeader);
+
+ newLeader.broadcastUserInfo();
+
+ clan.broadcastClanStatus();
+
+ SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_LEADER_PRIVILEGES_HAVE_BEEN_TRANSFERRED_TO_C1);
+ sm.addString(newLeader.getName());
+ clan.broadcastToOnlineMembers(sm);
+ activeChar.sendMessage("Clan leader has been changed!");
+ CommunityServerThread.getInstance().sendPacket(new WorldInfo(null, clan, WorldInfo.TYPE_UPDATE_CLAN_DATA));
+ }
+ }
+ }
+ else
+ {
+ activeChar.sendMessage("Player is offline");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return true;
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
Index: data/html/admin/claninfo.htm
===================================================================
--- data/html/admin/claninfo.htm (revision 0)
+++ data/html/admin/claninfo.htm (revision 0)
@@ -0,0 +1,44 @@
+<html><title>Clan Information Panel: %clan_name%</title><body>
+<center>
+<table width=270>
+<tr>
+<td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+<td width=180><center>Clan: %clan_name%</center></td>
+<td width=45><button value="Back" action="bypass -h admin_admin7" width=45 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+</tr>
+</table>
+<br>
+<br>
+<br>
+<table width=240 bgcolor="666666">
+<tr>
+<td>Clan Name:</td><td>%clan_name%</td>
+</tr>
+<tr>
+<td>Leader:</td><td>%clan_leader%</td>
+</tr>
+<tr>
+<td>Level:</td><td>%clan_level%</td>
+</tr>
+<tr>
+<td>Has Castle:</td><td>%clan_has_castle%</td>
+</tr>
+<tr>
+<td>Has Clan Hall:</td><td>%clan_has_clanhall%</td>
+</tr>
+<tr>
+<td>Has Fortress:</td><td>%clan_has_fortress%</td>
+</tr>
+<tr>
+<td>Rep. Points:</td><td>%clan_points%</td>
+</tr>
+<tr>
+<td>Players Count:</td><td>%clan_players_count%</td>
+</tr>
+<tr>
+<td>Ally :</td><td>%clan_ally%</td>
+</tr>
+<tr>
+<td>Change Leader:</td><td><a action="bypass -h admin_clan_changeleader %current_player_objectId%">%current_player_name%</a></td>
+</tr>
+</table>
\ No newline at end of file
#98
L2 | Comandos / Comando .xpoff .xpon
Último mensaje por Swarlog - Jun 25, 2025, 09:40 PM
CitarCORE:

Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java   (revision 4267)
+++ java/com/l2jserver/Config.java   (working copy)
@@ -650,6 +650,7 @@
    public static boolean BANKING_SYSTEM_ENABLED;
    public static int BANKING_SYSTEM_GOLDBARS;
    public static int BANKING_SYSTEM_ADENA;
+   public static boolean NOXPGAIN_ENABLED;
    public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;
    public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
    public static boolean OFFLINE_TRADE_ENABLE;
@@ -2217,6 +2218,8 @@
                BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
                BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
                BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));
+               
+               NOXPGAIN_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("NoXPGainEnable", "false"));
 
                OFFLINE_TRADE_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineTradeEnable", "false"));
                OFFLINE_CRAFT_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineCraftEnable", "false"));
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 4272)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -804,6 +804,18 @@
 
    private int _movieId = 0;
 
+   private boolean _cantGainXP;
+
+   public void cantGainXP(boolean b)
+   {
+      _cantGainXP = b;
+   }
+   
+   public boolean cantGainXP()
+   {
+      return _cantGainXP;
+   }
+   
    private Future<?> _PvPRegTask;
 
    private long _pvpFlagLasts;
Index: java/com/l2jserver/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/stat/PcStat.java   (revision 4241)
+++ java/com/l2jserver/gameserver/model/actor/stat/PcStat.java   (working copy)
@@ -64,7 +64,7 @@
        L2PcInstance activeChar = getActiveChar();
 
         // Allowed to gain exp?
-       if (!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty())
+       if (!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty() || (Config.NOXPGAIN_ENABLED && getActiveChar().cantGainXP()))
               return false;
 
       if (!super.addExp(value)) return false;
@@ -103,7 +103,7 @@
        float ratioTakenByPet = 0;
        // Allowd to gain exp/sp?
        L2PcInstance activeChar = getActiveChar();
-       if (!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty())
+       if (!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty() || (Config.NOXPGAIN_ENABLED && getActiveChar().cantGainXP()))
              return false;
 
        // if this player has a pet that takes from the owner's Exp, give the pet Exp now
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties   (revision 4267)
+++ java/config/l2jmods.properties   (working copy)
@@ -223,6 +223,12 @@
 # Amount of Adena a player gets when they use the ".withdraw" command. Also the same amount they will lose with ".deposit".
 BankingAdenaCount = 500000000
 
+# ---------------------------------------------------------------------------
+# Voice-command for turning off XP-gain
+# ---------------------------------------------------------------------------
+# Player can use .xpoff to disable XP-gain, and .xpon to enable again.
+# Default: False
+NoXPGainEnable = False
 
 # ---------------------------------------------------------------------------
 # Warehouse Sorting

CitarDATA:

Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java   (revision 7452)
+++ data/scripts/handlers/MasterHandler.java   (working copy)
@@ -299,6 +299,8 @@
          VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());
       if (Config.BANKING_SYSTEM_ENABLED)
          VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());
+      if (Config.NOXPGAIN_ENABLED)
+         VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new NoExp());
       if (Config.TVT_ALLOW_VOICED_COMMAND)
          VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TvTVoicedInfo());
       if (Config.L2JMOD_CHAT_ADMIN)
Index: data/scripts/handlers/voicedcommandhandlers/NoExp.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/NoExp.java   (revision 0)
+++ data/scripts/handlers/voicedcommandhandlers/NoExp.java   (revision 0)
@@ -0,0 +1,60 @@
+/*
+ * 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 com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class allows user to turn XP-gain off and on.
+ *
+ * @author Notorious
+ */
+public class NoExp implements IVoicedCommandHandler
+{
+   private static final String[] _voicedCommands =
+   {
+      "xpoff",
+      "xpon"
+   };
+   
+   /**
+    *
+    * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
+    */
+   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+   {
+      if (command.equalsIgnoreCase("xpoff"))
+      {
+         activeChar.cantGainXP(true);
+         activeChar.sendMessage("You have turned XP-gain OFF!");
+      }
+      else if (command.equalsIgnoreCase("xpon"))
+      {
+         activeChar.cantGainXP(false);
+         activeChar.sendMessage("You have turned XP-gain ON!");
+      }
+      return true;
+   }
+   
+   /**
+    *
+    * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
+    */
+   public String[] getVoicedCommandList()
+   {
+      return _voicedCommands;
+   }
+}
 
#99
L2 | Comandos / Comandos para el TvT
Último mensaje por Swarlog - Jun 25, 2025, 09:40 PM
/*
 * Copyright (C) 2004-2014 L2J DataPack
 *
 * This file is part of L2J DataPack.
 *
 * L2J DataPack 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.
 *
 * L2J DataPack 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 com.l2jserver.Config;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;

import custom.events.TvT.TvTManager.TvTManager;

/**
 * Tvt info.
 * @author denser
 */
public class TvTVoicedInfo implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"tvt",
"join",
"leave"
};

/**
* Set this to false and recompile script if you don't want to use string cache.<br>
* This will decrease performance but will be more consistent against possible html editions during runtime Recompiling the script will get the new html would be enough too [DrHouse]
*/
private static final boolean USE_STATIC_HTML = true;
private static final String HTML = HtmCache.getInstance().getHtm(null, "data/html/mods/TvTEvent/Status.htm");

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.equals("tvt"))
{
if (TvTEvent.isStarting() || TvTEvent.isStarted())
{
String htmContent = (USE_STATIC_HTML && !HTML.isEmpty()) ? HTML : HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/TvTEvent/Status.htm");
try
{
final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage();

npcHtmlMessage.setHtml(htmContent);
// npcHtmlMessage.replace("%objectId%",
// String.valueOf(getObjectId()));
npcHtmlMessage.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
npcHtmlMessage.replace("%team1playercount%", String.valueOf(TvTEvent.getTeamsPlayerCounts()[0]));
npcHtmlMessage.replace("%team1points%", String.valueOf(TvTEvent.getTeamsPoints()[0]));
npcHtmlMessage.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
npcHtmlMessage.replace("%team2playercount%", String.valueOf(TvTEvent.getTeamsPlayerCounts()[1]));
npcHtmlMessage.replace("%team2points%", String.valueOf(TvTEvent.getTeamsPoints()[1]));
activeChar.sendPacket(npcHtmlMessage);
}
catch (Exception e)
{
_log.warning("wrong TvT voiced: " + e);
}
}
else
{
activeChar.sendMessage("TvT Event isnt in progress.");
return false;
}
}
else if (command.equals("join"))
{
final Quest managerAi = QuestManager.getInstance().getQuest(TvTManager.class.getSimpleName());
managerAi.notifyEvent("join", null, activeChar);
}
else if (command.equals("leave"))
{
final Quest managerAi = QuestManager.getInstance().getQuest(TvTManager.class.getSimpleName());
managerAi.notifyEvent("remove", null, activeChar);
}
return true;
}

@Override
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
#100
L2 | Implementaciones / JServer - Lista de códigos cam...
Último mensaje por Swarlog - Jun 25, 2025, 09:36 PM
Se trata de un listado de códigos que han cambiado en los emuladores Java Server, y de este modo ayudaros con su adaptación en vuestros proyectos con versiones antiguas. La lista se actualizará con forme va cambiado los valores del emulador.

Anuncios:
Anuncios:
Antes:
Announcements.getInstance().announceToAll("Anuncio de ejemplo!");
Ahora:

Broadcast.toAllOnlinePlayers("Anuncio de ejemplo!");

L2Skill
Antes: L2Skill
Ahora: Skill

SkillTable
Antes: SkillTable
Ahora: SkillData

getSkillType
Antes: if (skill.getSkillType(BUFF) == L2SkillType.BUFF
Ahora: if (skill.hasEffectType(L2EffectType.STUN)

applyEffects
Antes:

import com.l2jserver.gameserver.datatables.SkillTable;SkillTable.getInstance().getInfo(buffId, 1).applyEffects(playerx, playerx);
Ahora:

import com.l2jserver.gameserver.datatables.SkillData;SkillData.getInstance().getSkill(buffId, 1).applyEffects(playerx, playerx);

createDummyItem
- lootItems.add(ItemTable.getInstance().createDummyItem(item.getId()).getItem());
+ lootItems.add(ItemTable.getInstance().getTemplate(item.getId()));

- if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+ if (ItemTable.getInstance().getTemplate(reward[0]).isStackable())

- final L2ItemInstance _tmpItem = ItemTable.getInstance().createDummyItem(itemId);
+ final L2Item item = ItemTable.getInstance().getTemplate(itemId);


getAnySpawn/findAny

final L2Spawn spawn = SpawnTable.getInstance().getAnySpawn(npcId);
Por este otro:

final L2Spawn spawn = SpawnTable.getInstance().findAny(npcId);

IdFactory.getInstance()

npc1 = new L2MonsterInstance(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(mid1));
Por este otro:

npc1 = new L2MonsterInstance(NpcData.getInstance().getTemplate(mid1));

getScriptName

File configFile = new File("data/scripts/events/" + getScriptName() + "/config.xml");
Por este otro:

File configFile = new File("data/scripts/events/" + getName() + "/config.xml");

setTeam

setTeam(0);
setTeam(1);
setTeam(2);

Por este otro:

setTeam(Team.NONE);
setTeam(Team.BLUE);
setTeam(Team.RED);

getEfefcts
Antes: getEfefcts
Ahora: applyEffects

TextBuilder
Antes: TextBuilder contentBuffer = new TextBuilder();
Ahora: StringBuilder contentBuffer = new StringBuilder();

Javolution
Antes: protected Map<Integer, Boolean> _list1 = new FastMap<>();
Ahora: protected Map<Integer, Boolean> _list1 = new ConcurrentHashMap<>();

List/FastList
Antes: List<LoginStatusThread> lsToRemove = new FastList<>();
Ahora: List<LoginStatusThread> lsToRemove = new ArrayList<>();

Map/FastMap
Antes: Map<Integer, String> RaidBosses = new FastMap<>();
Ahora: Map<Integer, String> RaidBosses = new HashMap<>();

addItemNumber
Antes: msg.addItemNumber(_price);
Ahora: msg.addLong(_price);

getDistanceSq/calculateDistance
Antes: castleOwner.getDistanceSq(npc)
Ahora: castleOwner.calculateDistance(npc, true, true)

L2DatabaseFactory
Antes: L2DatabaseFactory.getInstance().getConnection();
Ahora: ConnectionFactory.getInstance().getConnection();

addSpecialProduct
Antes: MultiSell.addSpecialProduct(holder.getId(), holder.getCount(), player);
Ahora: MultisellData.hasSpecialIngredient(holder.getId(), holder.getCount(), player);

Stats Modificados
cAtk -> critDmg
cAtkAdd -> critDmgAdd
rCrit -> critRate
EnlargeAbnormalSlot -> enlargeAbnormalSlot
FreightLimit -> freightLimit
PrivateSellLimit -> privateSellLimit
PrivateBuyLimit -> privateBuyLimit
DwarfRecipeLimit -> dwarfRecipeLimit
CommonRecipeLimit -> commonRecipeLimit
PhysicalMpConsumeRate -> physicalMpConsumeRate
MagicalMpConsumeRate -> magicalMpConsumeRate
DanceMpConsumeRate -> danceMpConsumeRate
BowMpConsumeRate -> bowMpConsumeRate
MpConsume -> mpConsume

setSpawnLoc
Antes: inst.setSpawnLoc(EXIT_POINT);
Ahora: inst.setExitLoc(EXIT_POINT);

skill.getItemConsume()
Antes: skill.getItemConsume()
Ahora: skill.getItemConsumeCount()

NpcTemplate
Antes: NpcTemplate
Ahora: L2NpcTemplate

Announce
Antes: Announcements.getInstance().announceToAll
Ahora: Broadcast.announceToOnlinePlayers

AbnormalEffect
Antes: player.stopAbnormalEffect(AbnormalEffect.INVINCIBILITY);
Antes: player.startAbnormalEffect(AbnormalEffect.INVINCIBILITY);
Ahora: player.stopAbnormalVisualEffect(true, AbnormalVisualEffect.INVINCIBILITY);
Ahora: player.startAbnormalVisualEffect(true, AbnormalVisualEffect.INVINCIBILITY);

setPunishLevel
Antes: _player_cha.getActingPlayer().getActingPlayer().setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.ANTIBOT_TIME_JAIL);
Ahora: PunishmentManager.getInstance().startPunishment(new PunishmentTask(_player_cha.getActingPlayer().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + (60000 * Config.ANTIBOT_TIME_JAIL), "Bot", getClass().getSimpleName()));

addAttackPlayerDesire
Antes: addAttackPlayerDesire(npc, player.getActingPlayer());
Ahora: addAttackDesire(npc, player.getActingPlayer());

ChatType
Antes: ChatType
Ahora: Says2 --> gameserver-network-clientpackets