Noticias:

Menú Principal

Mensajes recientes

#61
L2 | Eventos / Evento Zombie
Último mensaje por Swarlog - Jun 28, 2025, 11:33 PM

   

    Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (revision 5667)
    +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
     @@ -302,6 +313,96 @@
      */
     public final class L2PcInstance extends L2Playable
     {
    +     
    +       public boolean _zombie = false;
    +       public void setZombie(boolean t)
    +       {
    +               _zombie = t;
    +       }
    +     
    +       public boolean isZombie()
    +       {
    +               return _zombie;
    +       }
    @@ -394,8 +494,19 @@
                    @Override
                    public void doAttack(L2Character target)
                    {
    +                       Zombie z = new Zombie();
                            super.doAttack(target);
    -                     
    +                       if (isZombie())
    +                       {
    +                             
    +                               L2PcInstance targeto = target.getActingPlayer();
    +                               z.infect(targeto);
    +                             
    +                               if (Zombie._notinfected.size() == 0)
    +                               {
    +                                       z.end();
    +                               }
    +                       }
                            // cancel the recent fake-death protection instantly if the player attacks or casts spells
                            getPlayer().setRecentFakeDeath(false);
                    }
    @@ -5389,6 +5576,15 @@
            @Override
            public synchronized void untransform()
            {
    +               if (isZombie())
    +               {
    +                       sendMessage("Fuck you noob cheater");
    +                       return;
    +               }
                    if (_transformation != null)
                    {
                            if (!fireTransformListeners(_transformation, false))
    \ No newline at end of file
    Index: java/com/l2jserver/gameserver/model/entity/Zombie.java
    ===================================================================
    --- java/com/l2jserver/gameserver/model/entity/Zombie.java      (revision 0)
    +++ java/com/l2jserver/gameserver/model/entity/Zombie.java      (revision 0)
    @@ -0,0 +1,298 @@
    +/* 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 com.l2jserver.gameserver.model.entity;
    +
    +import javolution.util.FastList;
    +
    +import com.l2jserver.gameserver.Announcements;
    +import com.l2jserver.gameserver.ThreadPoolManager;
    +import com.l2jserver.gameserver.datatables.DoorTable;
    +import com.l2jserver.gameserver.datatables.NpcTable;
    +import com.l2jserver.gameserver.datatables.SpawnTable;
    +import com.l2jserver.gameserver.instancemanager.TransformationManager;
    +import com.l2jserver.gameserver.model.L2Spawn;
    +import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
    +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
    +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
    +import com.l2jserver.util.Rnd;
    +
    +/**
    + * @author Marwan
    + */
    +public class Zombie
    +{
    +       public L2PcInstance zombie = null;
    +       public static L2Spawn _npcSpawn;
    +       public static FastList<L2PcInstance> all = new FastList<L2PcInstance>();
    +       public static FastList<L2PcInstance> _infected = new FastList<L2PcInstance>();
    +       public static FastList<L2PcInstance> _notinfected = new FastList<L2PcInstance>();
    +       public int rounds = 3;
    +     
    +       public static enum State
    +       {
    +               INACTIVE,
    +               ACTIVE
    +       }
    +     
    +       public State state = State.INACTIVE;
    +     
    +       public class Start implements Runnable
    +       {
    +               @Override
    +               public void run()
    +               {
    +                       if (state == State.INACTIVE)
    +                       {
    +                               startEvent();
    +                       }
    +               }
    +       }
    +     
    +       public void startEvent()
    +       {
    +               state = State.ACTIVE;
    +               all.addAll(_notinfected);
    +               all.addAll(_infected);
    +               Announcements.getInstance().announceToAll("Zombie event registrations will end in 10 minute(s).");
    +               Announcements.getInstance().announceToAll("Registration npc in giran.");
    +               spawnEventNpc();
    +               waitSecs(10);
    +               Announcements.getInstance().announceToAll("Zombie event registrations will end in 5 minute(s).");
    +               waitSecs(10);
    +               Announcements.getInstance().announceToAll("Zombie event registrations will end in 1 minute(s).");
    +               waitSecs(10);
    +             
    +               if (_notinfected.size() >= 2)
    +               {
    +                       closeDoor(24190002);
    +                       closeDoor(24190003);
    +                       closeDoor(24190001);
    +                       closeDoor(24190004);
    +                       pickZombie();
    +                       for (L2PcInstance players : _notinfected)
    +                       {
    +                               players.sendMessage("Zombie is " + zombie.getName());
    +                               players.teleToLocation(150108, 46736, -3407);
    +                       }
    +                       zombie.sendMessage("Infect others by hitting them");
    +                       zombie.teleToLocation(148498, 46752, -3413);
    +                       for (int i = 2; i <= rounds; i++)
    +                       {
    +                               i++;
    +                               waitSecs(110);
    +                               nextRound(i);
    +                       }
    +                       end();
    +               }
    +               else
    +               {
    +                       Announcements.getInstance().announceToAll("Zombie event has been cancelled due to lack of participants");
    +                       state = State.INACTIVE;
    +               }
    +             
    +       }
    +     
    +       public void nextRound(int round)
    +       {
    +               for (L2PcInstance pl : _notinfected)
    +               {
    +                     
    +                       pl.teleToLocation(147771, 46712, -3411);
    +                       ExShowScreenMessage message1 = new ExShowScreenMessage("Round " + round + " will start in 30 seconds.", 8000);
    +                       pl.sendPacket(message1);
    +               }
    +               for (L2PcInstance pl : _infected)
    +               {
    +                       pl.teleToLocation(151248, 46721, -3406);
    +                       ExShowScreenMessage message1 = new ExShowScreenMessage("Round " + round + " will start in 30 seconds.", 8000);
    +                       pl.sendPacket(message1);
    +               }
    +               waitSecs(30);
    +               for (L2PcInstance pl : _notinfected)
    +               {
    +                     
    +                       pl.teleToLocation(148515, 46660, -3413);
    +               }
    +               for (L2PcInstance pl : _infected)
    +               {
    +                       pl.teleToLocation(150400, 46764, -3413);
    +               }
    +       }
    +     
    +       private static void spawnEventNpc()
    +       {
    +               L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(70012);
    +             
    +               try
    +               {
    +                       _npcSpawn = new L2Spawn(tmpl);
    +                       _npcSpawn.setLocx(83450);
    +                       _npcSpawn.setLocy(148608);
    +                       _npcSpawn.setLocz(3405);
    +                       _npcSpawn.setAmount(1);
    +                       _npcSpawn.setHeading(1);
    +                       SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
    +                     
    +                       _npcSpawn.init();
    +                       _npcSpawn.getLastSpawn().setTitle("Zombie");
    +                       _npcSpawn.getLastSpawn().setName("Zombie Event");
    +               }
    +               catch (Exception e)
    +               {
    +               }
    +       }
    +     
    +       public void pickZombie()
    +       {
    +               zombie = _notinfected.get(Rnd.get(0, _notinfected.size() - 1));
    +               infect(zombie);
    +       }
    +     
    +       public void infect(L2PcInstance z)
    +       {
    +               _infected.add(z);
    +               _notinfected.remove(z);
    +               z.getAppearance().setTitleColor(255, 0, 0);
    +               z.setZombie(true);
    +               TransformationManager.getInstance().transformPlayer(303, z);
    +       }
    +     
    +       public void uninfectall()
    +       {
    +               for (L2PcInstance uninfect : _infected)
    +               {
    +                       uninfect.untransform();
    +                       uninfect.setZombie(false);
    +               }
    +       }
    +     
    +       public void end()
    +       {
    +                       openDoor(24190002);
    +                       openDoor(24190003);
    +                       openDoor(24190001);
    +                       openDoor(24190004);
    +                       uninfectall();
    +               rewardWinner();
    +               state = State.INACTIVE;
    +               for (L2PcInstance p : all)
    +               {
    +                       p.teleToLocation(83450, 148608, -3405);
    +               }
    +               if (_notinfected.size() >= 1)
    +               {
    +                       Announcements.getInstance().announceToAll("Zombie event has end");
    +                       Announcements.getInstance().announceToAll("Players won");
    +                       _notinfected.removeAll(_notinfected);
    +               }
    +               else
    +               {
    +                     
    +                       Announcements.getInstance().announceToAll("Zombie event has end");
    +                       Announcements.getInstance().announceToAll("Zombies won");
    +                       _infected.removeAll(_infected);
    +               }
    +             
    +       }
    +     
    +       public void register(L2PcInstance p)
    +       {
    +               _notinfected.add(p);
    +               p.sendMessage("You have succesfully registered");
    +       }
    +     
    +       public void unregister(L2PcInstance p)
    +       {
    +               _notinfected.remove(p);
    +               p.sendMessage("You have succesfully unregistered");
    +       }
    +     
    +       public void rewardWinner()
    +       {
    +               if (_notinfected.size() == 0)
    +               {
    +                       for (L2PcInstance n : _infected)
    +                       {
    +                               n.addItem("zombie", 57, 10000, n, false);
    +                       }
    +               }
    +               else
    +               {
    +                       for (L2PcInstance n : _notinfected)
    +                       {
    +                               n.addItem("zombie", 57, 10000, n, false);
    +                       }
    +               }
    +       }
    +     
    +       public void waitSecs(int i)
    +       {
    +               try
    +               {
    +                       Thread.sleep(i * 1000);
    +               }
    +               catch (InterruptedException ie)
    +               {
    +                       ie.printStackTrace();
    +               }
    +       }
    +     
    +       public void wait(int i)
    +       {
    +               try
    +               {
    +                       Thread.sleep(i * 60000);
    +               }
    +               catch (InterruptedException ie)
    +               {
    +                       ie.printStackTrace();
    +               }
    +       }
    +     
    +       private static void closeDoor(int i)
    +       {
    +             
    +               L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(i);
    +             
    +               if (doorInstance != null)
    +               {
    +                       doorInstance.closeMe();
    +               }
    +             
    +       }
    +     
    +       private static void openDoor(int i)
    +       {
    +               L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(i);
    +             
    +               if (doorInstance != null)
    +               {
    +                       doorInstance.openMe();
    +               }
    +       }
    +     
    +       public Zombie()
    +       {
    +               ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new Start(), 60000, 6000);
    +             
    +       }
    +     
    +       public static Zombie getInstance()
    +       {
    +               return SingletonHolder._instance;
    +       }
    +     
    +       private static class SingletonHolder
    +       {
    +               protected static final Zombie _instance = new Zombie();
    +       }
    +}
    Index: java/com/l2jserver/gameserver/instancemanager/ZombieNpc.java
    ===================================================================
    --- java/com/l2jserver/gameserver/instancemanager/ZombieNpc.java        (revision 0)
    +++ java/com/l2jserver/gameserver/instancemanager/ZombieNpc.java        (revision 0)
    @@ -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.gameserver.instancemanager;
    +
    +import com.l2jserver.Config;
    +import com.l2jserver.gameserver.model.actor.L2Npc;
    +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jserver.gameserver.model.entity.Zombie;
    +import com.l2jserver.gameserver.model.quest.Quest;
    +import com.l2jserver.gameserver.model.quest.QuestState;
    +
    +/**
    + * Zombie Npc
    + * @author Marwan
    + */
    +public final class ZombieNpc extends Quest
    +{
    +     
    +       private final int NpcId = 70012;
    +     
    +       private ZombieNpc(int questId, String name, String descr)
    +       {
    +             
    +               super(questId, name, descr);
    +               addStartNpc(NpcId);
    +               addTalkId(NpcId);
    +       }
    +     
    +       @Override
    +       public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    +       {
    +               QuestState st = player.getQuestState("ZombieNpc");
    +               if (st == null)
    +               {
    +                       return "";
    +               }
    +               else if (event.equalsIgnoreCase("show"))
    +               {
    +                       StringBuilder sb = new StringBuilder();
    +                       sb.append("<html><title>TvT Event</title>");
    +                       sb.append("<body>");
    +                       // sb.append("<br><font color=\"0066FF\">Current Event: 1vs1 </font>");
    +                       sb.append("<br><br><font color=\"00ff4d\">Hello " + player.getName() + ".<br> Here you can register for Zombie Event <br><br></font>");
    +                       sb.append("<hr>");
    +                       sb.append("<br><br><br><br>");
    +                       sb.append("<center><img src=\"L2UI.SquareWhite\" width=300 height=1>");
    +                       sb.append("<table bgcolor=333333 width=100>");
    +                       sb.append("<tr>");
    +                       sb.append("<td width=100 ALIGN=\"LEFT\"><button value=\"Register\" action=\"bypass -h Quest ZombieNpc register\" width=100 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
    +                       sb.append("<td width=100 ALIGN=\"RIGHT\"><button value=\"Unregister\" action=\"bypass -h Quest ZombieNpc unregister\" width=100 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td></tr>");
    +                       sb.append("<br><tr><td width=150 ALIGN=\"CENTER\"><button value=\"Registered Players\" action=\"bypass -h Quest ZombieNpc players\" width=150 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td></tr>");
    +                     
    +                       sb.append("</tr>");
    +                       sb.append("</table>");
    +                       sb.append("<br><br></center>");
    +                       return sb.toString();
    +               }
    +             
    +               else if (event.equalsIgnoreCase("register"))
    +               {
    +                     
    +                       StringBuilder sb = new StringBuilder();
    +                       if (Zombie._notinfected.contains(player))
    +                       {
    +                               sb.append("<html><title>Zombie Event</title><body>");
    +                               sb.append("You are already registered</body></html>");
    +                       }
    +                       else
    +                       {
    +                               sb.append("<html><title>Zombie Event</title><body>");
    +                               sb.append("Registration succesful</body></html>");
    +                               Zombie z = new Zombie();
    +                               z.register(player);
    +                             
    +                       }
    +                       return sb.toString();
    +                     
    +               }
    +               else if (event.equalsIgnoreCase("unregister"))
    +               {
    +                     
    +                       StringBuilder sb = new StringBuilder();
    +                       sb.append("<html><title>Zombie Event</title>");
    +                       sb.append("<body>You have succesfully unregistered</body></html>");
    +                       Zombie z = new Zombie();
    +                       z.unregister(player);
    +                       return sb.toString();
    +               }
    +               else if (event.equalsIgnoreCase("players"))
    +               {
    +                       StringBuilder sb = new StringBuilder();
    +                       String noobs = null;
    +                       sb.append("<html><title>Zombie Event</title><body><center>");
    +                       sb.append("<br><br><table width=300><tr><td>Name</td><td width=80>Level</td></tr><br></font>");
    +                       for (L2PcInstance pls : Zombie._notinfected)
    +                       {
    +                               noobs += "<tr><td><font color=\"009900\">" + pls.getName() + "</td><td>" + pls.getLevel() + "</font></td></tr>";
    +                       }
    +                       sb.append("<table>" + noobs + "</table></body></html>");
    +                       return sb.toString();
    +                     
    +               }
    +             
    +               return event;
    +       }
    +     
    +       @SuppressWarnings("synthetic-access")
    +       public static ZombieNpc getInstance()
    +       {
    +               return SingletonHolder._instance;
    +       }
    +     
    +       private static class SingletonHolder
    +       {
    +               @SuppressWarnings("synthetic-access")
    +               private static final ZombieNpc _instance = new ZombieNpc(-1, "ZombieNpc", "instances");
    +       }
    +     
    +}


CitarNPC: ID 70012 Type: L2Npc

<button value="Event" action="bypass -h Quest Zombie show" width=90 height=25

Para cambiar el nº de rondas: public int rounds = 3;
#62
Presentaciones y Despedidas / Re:Buenas tardes
Último mensaje por Swarlog - Jun 28, 2025, 11:31 PM
Cita de: Ana en Jun 28, 2025, 12:40 PMHola, soy nueva, es un placer haber entrado. Espero aprender mucho por aquí

Saludos y bienvenida a la comunidad!
#63
Presentaciones y Despedidas / Buenas tardes
Último mensaje por Ana - Jun 28, 2025, 12:40 PM
Hola, soy nueva, es un placer haber entrado. Espero aprender mucho por aquí
#64
L2 | Instancias / Noblesse Instance
Último mensaje por Swarlog - Jun 25, 2025, 09:56 PM
package events.NoblesseInstance;

import javolution.util.FastMap;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.serverpackets.Earthquake;
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.Rnd;

public class NoblesseInstance extends Quest
{

private static final String qn = "NoblesseInstance";

private static final int INSTANCEID = 555555;

//NPCs
private static final int MANAGER = 999991;

private static int counter = 0;
   
private FastMap<Integer, Integer> _mobs;

private class teleCoord
{
int instanceId;
int x;
int y;
int z;
}
private class BSPWorld extends InstanceWorld
{
public long[] storeTime = { 0, 0 };

public BSPWorld()
{
}
}

/**
* @param questId
* @param name
* @param descr
*/
public NoblesseInstance(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(MANAGER);
addTalkId(MANAGER);

_mobs = new FastMap<Integer, Integer>();

}

private static final void removeBuffs(L2Character ch)
{
for (final L2Effect e : ch.getAllEffects())
{
if (e == null)
continue;
final L2Skill skill = e.getSkill();
if (skill.isDebuff() || skill.isStayAfterDeath())
continue;
e.exit();
}
if (ch.getPet() != null)
for (final L2Effect e : ch.getPet().getAllEffects())
{
if (e == null)
continue;
final L2Skill skill = e.getSkill();
if (skill.isDebuff() || skill.isStayAfterDeath())
continue;
e.exit();
}
}

private boolean checkConditions(L2PcInstance player)
{
final L2Party party = player.getParty();
if (party == null)
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-01.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage("You are not in party!", 3000));
return false;
}
if (party.getLeader() != player)
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-02.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage("You are not leading your party!", 3000));
return false;
}
if (party.getMemberCount() < 2)
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-03.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage("Your party must have at least 4 members!", 3000));
return false;
}
if (player.isNoble())
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-04.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage("You are already noblesse!", 3000));
return false;
}
if (player.getLevel() < 78)
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-08.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage("Your level is too low!", 3000));
return false;
}
for (final L2PcInstance partyMember : party.getPartyMembers())
{
if (partyMember.isNoble())
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-05.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage(partyMember.getName() + " is already noblesse. Your party cannot enter!", 3000));
return false;
}
if (partyMember.getLevel() < 78)
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-06.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage(partyMember.getName() + "'s level is too low. Your party cannot enter!", 3000));
return false;
}
if (!Util.checkIfInRange(1000, player, partyMember, true))
{
NpcHtmlMessage msg = new NpcHtmlMessage(0);
msg.setFile(player.getHtmlPrefix(), "data/scripts/events/NoblesseInstance/999991-07.htm");
player.sendPacket(msg);
player.sendPacket(new ExShowScreenMessage(partyMember.getName() + " is too far away. Your party cannot enter!", 3000));
return false;
}
final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
if (System.currentTimeMillis() < reentertime)
{
player.sendPacket(new ExShowScreenMessage("Test Me!", 3000));
return false;
}
}
return true;
}

private void teleportplayer(L2PcInstance player, teleCoord teleto)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.setInstanceId(teleto.instanceId);
player.teleToLocation(teleto.x, teleto.y, teleto.z);
return;
}

protected int enterInstance(L2PcInstance player, String template, teleCoord teleto)
{
int instanceId = 0;
//check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
//existing instance
if (world != null)
{
if (!(world instanceof BSPWorld))
{
player.sendPacket(new ExShowScreenMessage("Before joining to this leave previous instance!", 3000));
return 0;
}
teleto.instanceId = world.instanceId;
teleportplayer(player, teleto);
return instanceId;
}
//New instance
else
{
if (!checkConditions(player))
return 0;
final L2Party party = player.getParty();
instanceId = InstanceManager.getInstance().createDynamicInstance(template);
world = new BSPWorld();
world.instanceId = instanceId;
world.templateId = INSTANCEID;
world.status = 0;
((BSPWorld) world).storeTime[0] = System.currentTimeMillis();
InstanceManager.getInstance().addWorld(world);
_log.info("Noblesse Instance " + template + " Instance: " + instanceId + " created by player: " + player.getName());
//runTumors((BSPWorld) world);
// teleport players
teleto.instanceId = instanceId;

if (player.getParty() == null)
{
teleportplayer(player, teleto);
removeBuffs(player);
world.allowed.add(player.getObjectId());
}
else
for (final L2PcInstance partyMember : party.getPartyMembers())
{
teleportplayer(partyMember, teleto);
removeBuffs(partyMember);
world.allowed.add(partyMember.getObjectId());
}
return instanceId;
}
}

protected void exitInstance(L2PcInstance player, teleCoord tele, int tId)
{
player.setInstanceId(0);
if (tId > 0)
InstanceManager.getInstance().setInstanceTime(player.getObjectId(), tId, System.currentTimeMillis() * 60000 * 60 * 24);
player.teleToLocation(tele.x, tele.y, tele.z);
final L2Summon pet = player.getPet();
if (pet != null)
{
pet.setInstanceId(0);
pet.teleToLocation(tele.x, tele.y, tele.z);
}
}


public static void main(String[] args)
{
new NoblesseInstance(-1, qn, "NoblesseInstance");
}

}
#65
L2 | Instancias / Blood Shed Party Instance
Último mensaje por Swarlog - Jun 25, 2025, 09:55 PM






CitarBloodShedParty.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 events.BloodShedParty;

import javolution.util.FastMap;

import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.serverpackets.Earthquake;
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.Rnd;

/**
 * Bloodshedparty (555555) instance zone.
 * @author Swarlog
 */

public class BloodShedParty extends Quest
{
    private static final String qn = "Bloodshedparty";
   
    private static final int INSTANCEID = 555555;
   
    // Items
    private static final int E_APIGA = 14720;
    private static final int ADENA = 57;
    private static final int APIGA = 14721;
    private static final int STONE82 = 10486;
    private static final int STONE84 = 14169;
    private static final int SCROLLW = 6578;
    private static final int SCROLLA = 6577;
    private static final int GOLDDRAGON = 3481;
   
    // NPCs
    private static final int ROSE = 555555;
    private static final int CHEST = 2010010;
    private static final int MOBS = 2010001;
   
    // FIRST CHAMBER MOBS
    private static final int PROTECTOR = 2010005;
   
    private static final int BELETH = 2010007;
    private static final int BAYLOR = 2010008;
    private static final int TIAT = 2010009;
   
    // Doors
    private static final int[] DOOR =
    {
        20240001
    };
   
    private final FastMap<Integer, Integer> _mobs;
   
    private class BSPWorld extends InstanceWorld
    {
        public long[] storeTime =
        {
            0,
            0
        };
       
        public BSPWorld()
        {
            // empty
        }
    }
   
    private boolean checkConditions(L2PcInstance player)
    {
        final L2Party party = player.getParty();
        if (party == null)
        {
            player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER));
            player.sendPacket(new ExShowScreenMessage("You need to be in party to enter.", 3000));
            return false;
        }
       
        if (party.getLeader() != player)
        {
            player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER));
            player.sendPacket(new ExShowScreenMessage("Only party leader can enter", 3000));
            return false;
        }
       
        if (party.getMemberCount() < 9)
        {
            player.sendPacket(new ExShowScreenMessage("Your party must have at least 9 players", 3000));
            return false;
        }
       
        for (final L2PcInstance partyMember : party.getMembers())
        {
            if (partyMember.getLevel() < 78)
            {
                final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
                sm.addPcName(partyMember);
                party.broadcastPacket(sm);
                return false;
            }
           
            if (!Util.checkIfInRange(1000, player, partyMember, true))
            {
                final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED);
                sm.addPcName(partyMember);
                party.broadcastPacket(sm);
                return false;
            }
           
            final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
            if (System.currentTimeMillis() < reentertime)
            {
                final SystemMessage sm = SystemMessage.getSystemMessage(2100);
                sm.addPcName(partyMember);
                party.broadcastPacket(sm);
                return false;
            }
        }
       
        return true;
    }
   
    protected int enterInstance(L2PcInstance player, String template, Location loc)
    {
        int instanceId = 0;
        // Check for existing instances for this player
        InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
        // Existing instance
        if (world != null)
        {
            if (!(world instanceof BSPWorld))
            {
                player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER));
                return 0;
            }
           
            teleportPlayer(player, loc, world.getInstanceId());
            return instanceId;
        }
       
        // New instance
        if (!checkConditions(player))
        {
            return 0;
        }
        final L2Party party = player.getParty();
        instanceId = InstanceManager.getInstance().createDynamicInstance(template);
        world = new BSPWorld();
        world.setInstanceId(instanceId);
        world.setTemplateId(INSTANCEID);
        world.setStatus(0);
        for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
        {
            if (Util.contains(DOOR, door.getId()))
            {
                door.setIsAttackableDoor(true);
            }
        }
       
        ((BSPWorld) world).storeTime[0] = System.currentTimeMillis();
        InstanceManager.getInstance().addWorld(world);
        _log.info("Blood Sheed Party Event " + template + " Instance: " + instanceId + " created by player: " + player.getName());
        // runTumors((BSPWorld) world);
        // teleport players
       
        if (player.getParty() == null)
        {
            teleportPlayer(player, loc, world.getInstanceId());
            // removeBuffs(player);
            world.addAllowed(player.getObjectId());
        }
        else
        {
            for (final L2PcInstance partyMember : party.getMembers())
            {
                teleportPlayer(partyMember, loc, world.getInstanceId());
                // removeBuffs(partyMember);
                world.addAllowed(partyMember.getObjectId());
            }
        }
        return instanceId;
    }
   
    @Override
    public String onTalk(L2Npc npc, L2PcInstance player)
    {
        final int npcId = npc.getId();
        if (npcId == ROSE)
        {
            enterInstance(player, "Bloodshedparty.xml", new Location(16345, 209051, -9357));
            return "";
        }
        else if (npcId == CHEST)
        {
            InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
            player.sendPacket(new ExShowScreenMessage("This world was destroied: Completed", 8000));
            player.sendPacket(new ExShowScreenMessage("Baylor: You fools, We will meet in your world soon.....Aha ha ha", 15000));
            final L2Party party = player.getParty();
            if (party != null)
            {
                for (final L2PcInstance partyMember : party.getMembers())
                {
                    partyMember.addItem("Event", ADENA, 20000000, player, true);
                    if (Rnd.get(100) < 10)
                    {
                        partyMember.addItem("Event", STONE84, 10, player, true);
                    }
                    if (Rnd.get(100) < 15)
                    {
                        partyMember.addItem("Event", STONE82, 10, player, true);
                    }
                    if (Rnd.get(100) < 25)
                    {
                        partyMember.addItem("Event", APIGA, 50, player, true);
                    }
                    if (Rnd.get(100) < 25)
                    {
                        partyMember.addItem("Event", SCROLLA, 20, player, true);
                    }
                    if (Rnd.get(100) < 50)
                    {
                        partyMember.addItem("Event", SCROLLW, 10, player, true);
                    }
                   
                    teleportPlayer(partyMember, new Location(82200, 148347, -3467), world.getTemplateId());
                }
            }
            else
            {
                teleportPlayer(player, new Location(82200, 148347, -3467), 0);
            }
            npc.decayMe();
            Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
            inst.setEmptyDestroyTime(0);
        }
        return "";
    }
   
    @Override
    public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
    {
        final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
        final BSPWorld world = (BSPWorld) tmpworld;
       
        if (npc.getId() == MOBS)
        {
            if (GetKilledMobs(MOBS) == 6)
            {
                player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Master, Forgive Me! I failed"));
                player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "You fools, here's your end"));
                player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Ooo...It is a good day to die"));
                addSpawn(PROTECTOR, 16658, 211498, -9357, 0, false, 0, false, world.getInstanceId());
                openDoor(20240001, world.getInstanceId());
            }
        }
       
        if (npc.getId() == PROTECTOR)
        {
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Master, Forgive Me!"));
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "I failed, give me another chance to protect you"));
            player.sendPacket(new ExShowScreenMessage("Fools, here's your end!", 8000));
            // newNpc = self.addSpawn(int npcId,x,y,z,heading,randomOffset,despawnDelay,isSummonSpawn,instanceId);
            addSpawn(BELETH, 16344, 213091, -9356, 0, false, 0, false, world.getInstanceId());
            player.sendPacket(new Earthquake(16344, 213091, -9356, 20, 5));
        }
       
        if (npc.getId() == BELETH)
        {
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "My world....."));
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Baylorrrrr"));
            player.addItem("Event", E_APIGA, 5, player, true);
            player.sendPacket(new ExShowScreenMessage("Baylor:My Brother, I will avenge you!", 12000));
            // newNpc = self.addSpawn(int npcId,x,y,z,heading,randomOffset,despawnDelay,isSummonSpawn,instanceId)
            addSpawn(BAYLOR, 16344, 213091, -9356, 0, false, 0, false, world.getInstanceId());
            player.sendPacket(new Earthquake(16344, 213091, -9356, 20, 5));
        }
       
        if (npc.getId() == BAYLOR)
        {
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "My death is nothing, your end is near"));
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "You fools ....Aha ha ha ha"));
            player.addItem("Event", E_APIGA, 5, player, true);
            player.sendPacket(new ExShowScreenMessage("..............kill them all!", 8000));
            // newNpc = self.addSpawn(int npcId,x,y,z,heading,randomOffset,despawnDelay,isSummonSpawn,instanceId);
            addSpawn(TIAT, 16344, 213091, -9356, 0, false, 0, false, world.getInstanceId());
            player.sendPacket(new Earthquake(16344, 213091, -9356, 80, 5));
        }
       
        if (npc.getId() == TIAT)
        {
            player.sendPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Ugh.... Defeated.. How!?"));
            player.sendPacket(new ExShowScreenMessage("Congratulations! You Have Defeated Demonic Lord.", 12000));
            player.addItem("Event", E_APIGA, 10, player, true);
            player.addItem("Event", GOLDDRAGON, 4, player, true);
            // newNpc = self.addSpawn(int npcId,x,y,z,heading,randomOffset,despawnDelay,isSummonSpawn,instanceId)
            addSpawn(CHEST, 16225, 213040, -9357, 0, false, 0, false, world.getInstanceId());
        }
       
        return null;
    }
   
    private int GetKilledMobs(int npcId)
    {
        int t;
        if (_mobs.containsKey(npcId))
        {
            t = _mobs.get(npcId) + 1;
        }
        else
        {
            t = 1;
        }
       
        _mobs.put(npcId, t);
        return t;
    }
   
    /**
     * @param questId
     * @param name
     * @param descr
     */
    public BloodShedParty(int questId, String name, String descr)
    {
        super(questId, name, descr);
        addStartNpc(ROSE);
        addTalkId(ROSE);
        addTalkId(CHEST);
       
        addKillId(MOBS);
        addKillId(PROTECTOR);
        addKillId(BELETH);
        addKillId(BAYLOR);
        addKillId(TIAT);
       
        _mobs = new FastMap<>();
    }
   
    public static void main(String[] args)
    {
        new BloodShedParty(-1, qn, "Bloodshedparty");
    }
}

CitarBloodshedparty.xml

<?xml version="1.0" encoding="UTF-8"?>
<instance name="Bloodshedparty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="instance.xsd">
  <activityTime val="240" />
  <allowSummon val="false" />
  <emptyDestroyTime val="5" />
  <doorlist>
        <door doorId="20240001" />
  </doorlist>
  <spawnlist>
    <spawn npcId="2010001" x="16590" y="209973" z="-9357" heading="0" respawn="0" />
        <spawn npcId="2010001" x="16486" y="210007" z="-9357" heading="0" respawn="0" />
        <spawn npcId="2010001" x="16372" y="210028" z="-9357" heading="0" respawn="0" />
        <spawn npcId="2010001" x="16160" y="210057" z="-9357" heading="0" respawn="0" />
        <spawn npcId="2010001" x="16207" y="210069" z="-9357" heading="0" respawn="0" />
        <spawn npcId="2010001" x="16270" y="210076" z="-9357" heading="0" respawn="0" />
  </spawnlist>
</instance>

Citar555555.htm

<html>
<body>
Rose:<br>
Welcome Adventurer!<br>
Are you ready for a new adventure? Seeking new rewards? This is the place for you!<br>
<br>
<center>
<button action="bypass -h npc_%objectId%_Quest BloodShedParty" value="Solo Instance Event" width=200 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br1>
</center>
</body>
</html>
#66
L2 | Comandos / Comandos .expoff / .expon
Último mensaje por Swarlog - Jun 25, 2025, 09:53 PM
CitarCORE:

Index: java/com/l2jserver/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (revision 5757)
+++ java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -82,6 +82,12 @@
  {
  return false;
  }
+
+ // Check, if exp gain isn't disabled by voiced command
+ if (activeChar.canOverrideCond(PcCondOverride.DISABLE_EXP_GAIN))
+ {
+ return false;
+ }
 
  if (!super.addExp(value))
  {
@@ -133,7 +139,13 @@
  {
  return false;
  }
-
+
+ // Check, if exp gain isn't disabled by voiced command
+ if (activeChar.canOverrideCond(PcCondOverride.DISABLE_EXP_GAIN))
+ {
+ addToExp = 0;
+ }
+
  long baseExp = addToExp;
  int baseSp = addToSp;
 
Index: java/com/l2jserver/gameserver/model/PcCondOverride.java
===================================================================
--- java/com/l2jserver/gameserver/model/PcCondOverride.java (revision 5757)
+++ java/com/l2jserver/gameserver/model/PcCondOverride.java (working copy)
@@ -38,7 +38,8 @@
  DESTROY_ALL_ITEMS(12, "Overrides item destroy conditions"),
  SEE_ALL_PLAYERS(13, "Overrides the conditions to see hidden players"),
  TARGET_ALL(14, "Overrides target conditions"),
- DROP_ALL_ITEMS(15, "Overrides item drop conditions");
+ DROP_ALL_ITEMS(15, "Overrides item drop conditions"),
+ DISABLE_EXP_GAIN(16, "Disables experience gain");
 
  private final int _mask;
  private final String _descr;

CitarDATA:

Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9395)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -315,6 +315,7 @@
 import handlers.voicedcommandhandlers.Lang;
 import handlers.voicedcommandhandlers.StatsVCmd;
 import handlers.voicedcommandhandlers.TvTVoicedInfo;
+import handlers.voicedcommandhandlers.UserOptions;
 import handlers.voicedcommandhandlers.Wedding;
 
 /**
@@ -601,6 +602,7 @@
  {
  // Voiced Command Handlers
  StatsVCmd.class,
+ UserOptions.class,
  // TODO: Add configuration options for this voiced commands:
  // CastleVCmd.class,
  // SetVCmd.class,
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java (working copy)
@@ -0,0 +1,44 @@
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author GKR, Mr.Deff
+ */
+public class UserOptions implements IVoicedCommandHandler
+{
+ private static final String[] _voicedCommands =
+ {
+ "expon",
+ "expoff",
+ };
+
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (activeChar == null)
+ {
+ return false;
+ }
+
+ switch(command)
+ {
+ case "expoff":
+ activeChar.addOverrideCond(PcCondOverride.DISABLE_EXP_GAIN);
+ activeChar.sendMessage("Exp gain disabled.");
+ break;
+ case "expon":
+ activeChar.removeOverridedCond(PcCondOverride.DISABLE_EXP_GAIN);
+ activeChar.sendMessage("Exp gain restored.");
+ break;
+ }
+
+ return true;
+ }
+
+ public String[] getVoicedCommandList()
+ {
+ return _voicedCommands;
+ }
+}
#67
L2 | Comandos / Cambiar contraseña del jugador...
Último mensaje por Swarlog - Jun 25, 2025, 09:53 PM
Se trata de un comando a añadir en vuestros servidores con el que un jugador desde dentro del servidor, podrá cambiar su contraseña de cuenta mediante el uso de un comando. By Jing~Jang, espero que os guste!

/*
 * 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 java.security.MessageDigest;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;

import com.l2jfrozen.crypt.Base64;
import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;

/*
 * @Author: Unknow
 * @Adaptation: |-Jing~Jang-|
 */

public class ChangePassword implements IVoicedCommandHandler
{
private static final String[] _voicedCommands =
{
"changepass"
};

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if(command.equalsIgnoreCase("changepass") && 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() < 4)
{
activeChar.sendMessage("The new password is shorter than 4 characters! Please try with a longer one.");
return false;
}
if(newpass.length() > 25)
{
activeChar.sendMessage("The new password is longer than 25 characters! Please try with a shorter one.");
return false;
}

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;

Connection con = null;
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
statement.setString(1, activeChar.getAccountName());
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);

PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
ps.setString(1, Base64.encodeBytes(password));
ps.setString(2, activeChar.getAccountName());
passUpdated = ps.executeUpdate();
ps.close();
con.close();

if(passUpdated > 0)
{
activeChar.sendMessage("You have successfully changed your password!");
activeChar.sendPacket(new ExShowScreenMessage("You have successfully changed your password!#Enjoy :)", 6000));
}
else
{
activeChar.sendMessage("The password change was unsuccessful!");
activeChar.sendPacket(new ExShowScreenMessage("The password change was unsuccessful!!#U_u)", 6000));
}
}
else
{
activeChar.sendMessage("CurrentPass doesn't match with your current one.");
return false;
}
}
else
{
activeChar.sendMessage("Invalid pass data! Format: .changepass CurrentPass NewPass NewPass");
return false;
}
}
catch(Exception e)
{
activeChar.sendMessage("A problem occured while changing password!");
}
}
else
{
activeChar.sendMessage("To change your current password, you have to type the command in the following format(without the brackets []): [.changepass CurrentPass NewPass NewPass]. You should also know that the password is case sensitive.");
activeChar.sendPacket(new ExShowScreenMessage("To change your current password, you have to type the command in the following format(without the brackets []):#[.changepass CurrentPass NewPass NewPass]. You should also know that the password is case sensitive.)", 7000));
return false;
}

return true;
}

@Override
public String[] getVoicedCommandList()
{
return _voicedCommands;
}

}
#68
L2 | Comandos / Comando .repair Character Voic...
Último mensaje por Swarlog - Jun 25, 2025, 09:52 PM
No puedes ver este adjunto.

No puedes ver este adjunto.
#69
L2 | Comandos / Comando .epic (Status Grand Bo...
Último mensaje por Swarlog - Jun 25, 2025, 09:52 PM
/*
 * Copyright (C) 2004-2015 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 java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Logger;

import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;

/**
 * @author JMD.
 */

public class Epic implements IVoicedCommandHandler
{
static final Logger _log = Logger.getLogger(Epic.class.getName());
private static final String[] VOICED_COMMANDS =
{
"epic"
};

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
{
if (command.startsWith("epic"))
{
return Status(activeChar);
}
return false;
}

public boolean Status(L2PcInstance activeChar)
{

int[] BOSSES =
{
29001,
29006,
29014,
29020,
29028,
29068,
29118

};
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
final StringBuilder replyMSG = new StringBuilder("<html><body><center>");
// replyMSG.append("<font color=\"LEVEL\">* Grand Boss Status & Respawn *</font><br>");
for (int boss : BOSSES)
{
String name = NpcData.getInstance().getTemplate(boss).getName();
StatsSet stats = GrandBossManager.getInstance().getStatsSet(boss);
if (stats == null)
{
replyMSG.append("Stats for GrandBoss " + boss + " not found!<br>");
continue;
}

long delay = stats.getLong("respawn_time");
long currentTime = System.currentTimeMillis();
if (delay <= currentTime)
{
replyMSG.append("(" + name + ") is <font color=\"00FF00\">Alive</font><br>");

}
else
{
replyMSG.append("(" + name + ") is <font color=\"FF0000\">Dead</font> <font color=\"FF9900\">( " + sdf.format(new Date(delay)) + " )</font><br>");
}
}
replyMSG.append("</center></body></html>");
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
adminReply.setHtml(replyMSG.toString());
activeChar.sendPacket(adminReply);
return true;
}

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

By JMD
#70
L2 | Comandos / Buscador de npc/mob
Último mensaje por Swarlog - Jun 25, 2025, 09:52 PM
https://youtu.be/qcK85i9ORIk

Créditos : ChuChuQui