Noticias:

Menú Principal

Mensajes recientes

#31
L2 | Eventos / Evento Recompensa PvP Zone por...
Último mensaje por Swarlog - Jun 28, 2025, 11:57 PM

Cada 1 hora se reinicia el evento y se inicia una nueva ronda.
Al final del periodo el tipo que tiene la mayoría de pvp dentro de la zona que ha configurado obtiene una recompensa que es totalmente su negocio va a establecer.

Aquí está el núcleo de la función:
Código (javascript) [Seleccionar]
/*

* 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.model.events;



import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.util.Calendar;

import java.util.Date;



import net.sf.l2j.L2DatabaseFactory;

import net.sf.l2j.gameserver.Announcements;

import net.sf.l2j.gameserver.ThreadPoolManager;

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

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;



/**

* @author Elfocrash

*

*/

public class PlayerOfTheHour

{



public static long getTimeToOclock()

{

Date d = new Date();

  Calendar c = Calendar.getInstance();

    c.setTime(d);



   

        c.add(Calendar.HOUR, 1);



    c.set(Calendar.MINUTE, 0);

    c.set(Calendar.SECOND, 0);

  // System.out.print(c.getTime());

    long howMany = (c.getTimeInMillis()-d.getTime());

        return howMany;

}



public static String getNextHourToDate()

{

Date d = new Date();

  Calendar c = Calendar.getInstance();

    c.setTime(d);

    c.add(Calendar.HOUR, 1);

   

   

      return c.getTime().toString();

}

public static String getTimeToDate()

{

Date d = new Date();

  Calendar c = Calendar.getInstance();

    c.setTime(d);



   

        c.add(Calendar.HOUR, 1);



    c.set(Calendar.MINUTE, 0);

    c.set(Calendar.SECOND, 0);

   

   

        return c.getTime().toString();

}

public static int getZonePvp(L2PcInstance activeChar)

{

int id=0;

try (Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("SELECT zone_pvp FROM characters WHERE obj_Id=?");

statement.setInt(1, activeChar.getObjectId());

ResultSet rset = statement.executeQuery();



while (rset.next())

{

id = rset.getInt("zone_pvp");

}

rset.close();

statement.close();

}

catch (Exception e)

{

}

return id;

}



public static void addZonePvp(L2PcInstance activeChar)

{

try(Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("UPDATE characters SET zone_pvp=? WHERE obj_Id=?");

statement.setInt(1, getZonePvp(activeChar) +1);

statement.setInt(2, activeChar.getObjectId());

statement.executeUpdate();

statement.close();

}

catch(Exception e)

{



}

}



public static void resetZonePvp()

{

try(Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("UPDATE characters SET zone_pvp=0");

statement.executeUpdate();

statement.close();

}

catch(Exception e)

{



}

}



static int getTopZonePvpCount()

{

int id=0;

try (Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("SELECT zone_pvp FROM characters ORDER BY zone_pvp DESC LIMIT 1");

ResultSet rset = statement.executeQuery();



while (rset.next())

{

id = rset.getInt("zone_pvp");

}

rset.close();

statement.close();

}

catch (Exception e)

{

}

return id;

}



static String getTopZonePvpName()

{

String name = null;

try (Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("SELECT char_name FROM characters ORDER BY zone_pvp DESC LIMIT 1");

ResultSet rset = statement.executeQuery();



while (rset.next())

{

name = rset.getString("char_name");

}

rset.close();

statement.close();

}

catch (Exception e)

{

}

return name;

}



private PlayerOfTheHour()

{



}

public static void getTopHtml(L2PcInstance activeChar)

{

  NpcHtmlMessage htm = new NpcHtmlMessage(0);

    StringBuilder sb = new StringBuilder("<html><body>");

    sb.append("<center><br>Top 10 PvP:<br><br1>");

    Connection con = null;

            try

            {

              con = L2DatabaseFactory.getInstance().getConnection();

              PreparedStatement stm = con.prepareStatement("SELECT char_name,zone_pvp,accesslevel,online FROM characters ORDER BY zone_pvp DESC LIMIT 10");

              ResultSet rSet = stm.executeQuery();

              while (rSet.next())

              {

              int accessLevel = rSet.getInt("accesslevel");

              if (accessLevel > 0)

              {

                continue;

              }

              int pvpKills = rSet.getInt("zone_pvp");

              if (pvpKills == 0)

              {

                continue;

              }

              String pl = rSet.getString("char_name");

              sb.append("Player: <font color=\"LEVEL\">"+pl+"</font> PvPs: <font color=\"LEVEL\">"+pvpKills+"</font><br1>");

              }

            }

            catch (Exception e)

            {

              System.out.println("Error while selecting top 15 pvp from database.");

            }

            finally

            {

              try

              {

              if (con != null)

                con.close();

              }

              catch (Exception e)

              {}

            }

            sb.append("Next round: " + getTimeToDate() +"</body></html>");

            htm.setHtml(sb.toString());

            activeChar.sendPacket(htm);

  }



    public static void getInstance()

    {

   

        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()

        {

            @Override

           

            public void run()

            {

           

            Announcements.announceToAll("The Player of the Hour is " + getTopZonePvpName() + " with "+getTopZonePvpCount()+ " pvps");

            //TODO Your reward should go here.

            resetZonePvp();

            Announcements.announceToAll("New Player of the Hour just started. Go to Primeval Isle and show us what you got.");

Announcements.announceToAll("This round will end at: " + getNextHourToDate() + ".");

            }

        }, getTimeToOclock() ,  3600000);

    }

   

   

}

Usted también necesitará este VoicedCommand con el fin de comprobar el ranking de esta hora. El comando es .zonepvp.
Código (javascript) [Seleccionar]
/*

* 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.model.events.PlayerOfTheHour;





public class ZonePvp implements IVoicedCommandHandler

{

private static final String[] _voicedCommands = { "zonepvp"};





@Override

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)

{



if(command.equals(_voicedCommands[0]))

{

PlayerOfTheHour.getTopHtml(activeChar);



}

return true;

}



@Override

public String[] getVoicedCommandList()

{

return _voicedCommands;

}

}

También es necesario para hacer sus increasePvpKills () método siguiente aspecto:
Código (javascript) [Seleccionar]
public void increasePvpKills()

{

// Add karma to attacker and increase its PK counter

setPvpKills(getPvpKills() + 1);



if(isInsideZone(ZoneId.ZONE_PVP))

PlayerOfTheHour.addZonePvp(this);



// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter

sendPacket(new UserInfo(this));

}

Por fin lo que necesita esta zona. No te olvides de registrarlo en idDeZona:
Código (javascript) [Seleccionar]
/*

* 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.model.zone.type;



import net.sf.l2j.gameserver.model.actor.L2Character;

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

import net.sf.l2j.gameserver.model.zone.L2SpawnZone;

import net.sf.l2j.gameserver.model.zone.ZoneId;

import net.sf.l2j.gameserver.network.SystemMessageId;



/**

* An arena

* @author durgus

*/

public class L2ZonePvpZone extends L2SpawnZone

{

public L2ZonePvpZone(int id)

{

super(id);

}



@Override

protected void onEnter(L2Character character)

{

if (character instanceof L2PcInstance)

{

((L2PcInstance) character).sendMessage("You are now inside the Player of the Hour Zone.");

}



character.setInsideZone(ZoneId.ZONE_PVP, true);

character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);

}



@Override

protected void onExit(L2Character character)

{

character.setInsideZone(ZoneId.ZONE_PVP, false);

character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);



if (character instanceof L2PcInstance)

{

((L2PcInstance) character).sendMessage("You are no longer inside the Player of the Hour Zone.");

}

}



@Override

public void onDieInside(L2Character character)

{

}



@Override

public void onReviveInside(L2Character character)

{

}

}

Por último es necesario agregar esto en gameserver:
Código (javascript) [Seleccionar]
PlayerOfTheHour.getInstance();
Credito: Elfocrash
#32
L2 | Eventos / Evento High Rate Event
Último mensaje por Swarlog - Jun 28, 2025, 11:56 PM

Cómo funciona:

Usted clara Dark Omen Cata de las turbas.
Puede editar las estadísticas turbas existentes y se reduce a algo bueno.
Se presiona // darkopen y los mobs te engendrado junto con 2 jefes Anakim y Lilith y el guardián de entrada.
Se presiona // darkclose y todo queda despawned.
 
Tan simple como eso. Si usted tiene los conocimientos básicos puede instalarlo y configurarlo a su gusto.

Codigos:

package net.sf.l2j.gameserver.instancemanager;

import java.util.Calendar;
import java.util.Date;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Logger;

import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.datatables.SpawnTable;
import net.sf.l2j.gameserver.model.L2Spawn;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.util.Rnd;

public class DarkOmenEventManager {


private static Logger _log = Logger.getLogger(DarkOmenEventManager.class.getName());
private static Set<L2Spawn> _monsters = new CopyOnWriteArraySet<>();

public static boolean darkOmenRunning = false;

static int[] mobs={21162,21253,21184,21205,
21163,
21254,
21206,
21185,
21255,
21207,
21165,
21186
}; 



public static DarkOmenEventManager getInstance()
{
return SingletonHolder._instance;
}

private DarkOmenEventManager()
{
_log.info("DarkOmenEventManager: Event handler initialized.");
}

public static void despawnMnosters()
{
for (L2Spawn s : _monsters)
{
s.getLastSpawn().deleteMe();
s.stopRespawn();
SpawnTable.getInstance().deleteSpawn(s, false);
}
_monsters.clear();
}
public static void spawnAMonster(int x, int y, int z)
{
L2Spawn _monster = null;
L2NpcTemplate monster = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);

try
{
_monster = new L2Spawn(monster);
_monster.setLocx(x);
_monster.setLocy(y);
_monster.setLocz(z);
_monster.setHeading(1);
_monster.setRespawnDelay(15);
_monster.init();
_monster.getLastSpawn().decayMe();
_monster.getLastSpawn().spawnMe(_monster.getLastSpawn().getX(), _monster.getLastSpawn().getY(), _monster.getLastSpawn().getZ());
SpawnTable.getInstance().addNewSpawn(_monster, false);
_monsters.add(_monster);
}
catch (Exception e)
{ }
}

private static void spawnANpc(int id,int x, int y, int z)
{
L2Spawn _monster = null;
L2NpcTemplate monster = NpcTable.getInstance().getTemplate(id);

try
{
_monster = new L2Spawn(monster);
_monster.setLocx(x);
_monster.setLocy(y);
_monster.setLocz(z);
_monster.setHeading(1);
_monster.setRespawnDelay(15);
_monster.init();
_monster.getLastSpawn().decayMe();
_monster.getLastSpawn().spawnMe(_monster.getLastSpawn().getX(), _monster.getLastSpawn().getY(), _monster.getLastSpawn().getZ());
SpawnTable.getInstance().addNewSpawn(_monster, false);
_monsters.add(_monster);
}
catch (Exception e)
{ }
}

private static void spawnABoss(int id,int x, int y, int z)
{
L2Spawn _monster = null;
L2NpcTemplate monster = NpcTable.getInstance().getTemplate(id);

try
{
_monster = new L2Spawn(monster);
_monster.setLocx(x);
_monster.setLocy(y);
_monster.setLocz(z);
_monster.setHeading(1);
_monster.setRespawnDelay(2700);
_monster.init();
_monster.getLastSpawn().decayMe();
_monster.getLastSpawn().spawnMe(_monster.getLastSpawn().getX(), _monster.getLastSpawn().getY(), _monster.getLastSpawn().getZ());
SpawnTable.getInstance().addNewSpawn(_monster, false);
_monsters.add(_monster);
}
catch (Exception e)
{ }
}

private static class SingletonHolder
{
protected static final DarkOmenEventManager _instance = new DarkOmenEventManager();
}

public static void spawnMonsters()
{
spawnABoss(25283, -113866, -173122, -6754);
spawnABoss(25286, -120286, -177753, -6754);
spawnANpc(7027, -82162, 150962, -3129);
spawnANpc(7033, -8505, 14471, -4901);
spawnANpc(7034, -8497, 14711, -4901);
spawnAMonster(-18835,14691,-4901);
spawnAMonster(-18837,14863,-4901);
spawnAMonster(-18838,15092,-4901);
spawnAMonster(-18836,15347,-4904);
spawnAMonster(-18841,15591,-4901);
spawnAMonster(-18840,15843,-4901);
spawnAMonster(-19084,15784,-4899);
spawnAMonster(-19075,15570,-4899);
spawnAMonster(-19072,15367,-4899);
spawnAMonster(-19068,15162,-4899);
spawnAMonster(-19064,14954,-4899);
spawnAMonster(-19063,14717,-4899);
spawnAMonster(-19308,14642,-4901);
spawnAMonster(-19332,14815,-4901);
spawnAMonster(-19343,15033,-4901);
spawnAMonster(-19340,15302,-4901);
spawnAMonster(-19338,15572,-4901);
spawnAMonster(-19338,15834,-4901);
spawnAMonster(-18089,18321,-4901);
spawnAMonster(-18006,18158,-4901);
spawnAMonster(-18073,17957,-4901);
spawnAMonster(-17974,17779,-4901);
spawnAMonster(-18066,17601,-4901);
spawnAMonster(-17966,17361,-4901);
spawnAMonster(-18052,17125,-4904);
spawnAMonster(-17963,16935,-4901);
spawnAMonster(-18056,16737,-4901);
spawnAMonster(-17936,16642,-4901);
spawnAMonster(-17600,16672,-4901);
spawnAMonster(-17590,16841,-4901);
spawnAMonster(-17641,16957,-4901);
spawnAMonster(-17572,17118,-4901);
spawnAMonster(-17660,17307,-4901);
spawnAMonster(-17488,17568,-4901);
spawnAMonster(-17618,17664,-4901);
spawnAMonster(-17589,17859,-4901);
spawnAMonster(-17678,18068,-4901);
spawnAMonster(-17582,18253,-4901);
spawnAMonster(-14243,17890,-4901);
spawnAMonster(-14360,17889,-4901);
spawnAMonster(-14600,17896,-4901);
spawnAMonster(-14708,17997,-4901);
spawnAMonster(-14708,18215,-4901);
spawnAMonster(-14595,18335,-4901);
spawnAMonster(-14482,18380,-4899);
spawnAMonster(-14479,18155,-4899);
spawnAMonster(-14486,17883,-4899);
spawnAMonster(-14213,18096,-4899);
spawnAMonster(-14351,18108,-4899);
spawnAMonster(-14675,18099,-4899);
spawnAMonster(-13164,18333,-4901);
spawnAMonster(-13312,18324,-4901);
spawnAMonster(-13548,18310,-4901);
spawnAMonster(-13608,18172,-4899);
spawnAMonster(-13581,18026,-4899);
spawnAMonster(-13539,17890,-4901);
spawnAMonster(-13404,17887,-4899);
spawnAMonster(-13220,17901,-4901);
spawnAMonster(-13189,18057,-4899);
spawnAMonster(-13391,18112,-4899);
spawnAMonster(-13618,18932,-4901);
spawnAMonster(-13613,19077,-4901);
spawnAMonster(-13614,19231,-4899);
spawnAMonster(-13616,19407,-4901);
spawnAMonster(-13489,19409,-4901);
spawnAMonster(-13339,19414,-4899);
spawnAMonster(-13153,19413,-4901);
spawnAMonster(-13158,19252,-4899);
spawnAMonster(-13163,19030,-4901);
spawnAMonster(-13259,19022,-4901);
spawnAMonster(-13365,19146,-4899);
spawnAMonster(-13405,19263,-4899);
spawnAMonster(-13504,20856,-4901);
spawnAMonster(-13227,20838,-4901);
spawnAMonster(-12821,20831,-4901);
spawnAMonster(-12494,20833,-4901);
spawnAMonster(-12182,20825,-4901);
spawnAMonster(-11884,20824,-4901);
spawnAMonster(-12199,20904,-4901);
spawnAMonster(-12708,20907,-4901);
spawnAMonster(-13056,20920,-4901);
spawnAMonster(-13483,20923,-4901);
spawnAMonster(-13538,20375,-4901);
spawnAMonster(-13395,20487,-4901);
spawnAMonster(-13111,20392,-4901);
spawnAMonster(-13055,20506,-4901);
spawnAMonster(-12745,20399,-4901);
spawnAMonster(-12525,20500,-4901);
spawnAMonster(-12183,20396,-4904);
spawnAMonster(-12014,20507,-4901);
spawnAMonster(-11826,20424,-4901);
spawnAMonster(-11812,20658,-4899);
spawnAMonster(-12188,20637,-4899);
spawnAMonster(-12573,20624,-4899);
spawnAMonster(-12950,20623,-4899);
spawnAMonster(-13297,20624,-4899);
spawnAMonster(-13576,20627,-4899);
spawnAMonster(-10263,20055,-4901);
spawnAMonster(-10259,19762,-4901);
spawnAMonster(-10256,19514,-4901);
spawnAMonster(-10254,19181,-4901);
spawnAMonster(-10239,18899,-4901);
spawnAMonster(-10038,18916,-4899);
spawnAMonster(-10103,19155,-4899);
spawnAMonster(-9993,19234,-4899);
spawnAMonster(-10110,19544,-4899);
spawnAMonster(-10001,19613,-4899);
spawnAMonster(-9997,19894,-4899);
spawnAMonster(-10061,20002,-4899);
spawnAMonster(-9853,20097,-4901);
spawnAMonster(-9814,19988,-4901);
spawnAMonster(-9901,19878,-4901);
spawnAMonster(-9817,19786,-4901);
spawnAMonster(-9902,19699,-4901);
spawnAMonster(-9804,19589,-4901);
spawnAMonster(-9898,19489,-4901);
spawnAMonster(-9788,19324,-4901);
spawnAMonster(-9868,19225,-4901);
spawnAMonster(-9798,19055,-4901);
spawnAMonster(-9875,18969,-4901);
spawnAMonster(-9756,18843,-4901);
spawnAMonster(-8986,19421,-4901);
spawnAMonster(-9044,19238,-4899);
spawnAMonster(-8941,19234,-4899);
spawnAMonster(-8914,19086,-4901);
spawnAMonster(-9015,19021,-4901);
spawnAMonster(-8830,18986,-4899);
spawnAMonster(-8725,19042,-4899);
spawnAMonster(-8552,18962,-4901);
spawnAMonster(-8547,19143,-4899);
spawnAMonster(-8679,19179,-4899);
spawnAMonster(-8745,19258,-4899);
spawnAMonster(-8613,19380,-4901);
spawnAMonster(-8540,19298,-4901);
spawnAMonster(-8573,19480,-4901);
spawnAMonster(-8789,18115,-4899);
spawnAMonster(-8599,18117,-4899);
spawnAMonster(-8554,17939,-4901);
spawnAMonster(-8642,17949,-4901);
spawnAMonster(-8712,17875,-4899);
spawnAMonster(-8794,17911,-4899);
spawnAMonster(-8896,17936,-4901);
spawnAMonster(-8998,17904,-4904);
spawnAMonster(-9047,18001,-4901);
spawnAMonster(-8938,18042,-4899);
spawnAMonster(-8984,18190,-4899);
spawnAMonster(-8924,18292,-4901);
spawnAMonster(-9066,18324,-4901);
spawnAMonster(-12334,15827,-4901);
spawnAMonster(-12196,15818,-4901);
spawnAMonster(-12016,15827,-4901);
spawnAMonster(-11742,15834,-4901);
spawnAMonster(-11465,15834,-4904);
spawnAMonster(-11221,15833,-4901);
spawnAMonster(-10971,15835,-4901);
spawnAMonster(-10697,15837,-4901);
spawnAMonster(-10634,15744,-4901);
spawnAMonster(-10758,15710,-4901);
spawnAMonster(-10889,15700,-4901);
spawnAMonster(-11017,15704,-4901);
spawnAMonster(-11138,15697,-4901);
spawnAMonster(-11259,15686,-4901);
spawnAMonster(-11382,15676,-4899);
spawnAMonster(-11504,15671,-4899);
spawnAMonster(-11799,15680,-4904);
spawnAMonster(-12033,15664,-4899);
spawnAMonster(-12285,15668,-4899);
spawnAMonster(-12323,15524,-4899);
spawnAMonster(-12158,15511,-4899);
spawnAMonster(-11912,15509,-4899);
spawnAMonster(-11659,15496,-4899);
spawnAMonster(-11406,15491,-4899);
spawnAMonster(-11140,15482,-4901);
spawnAMonster(-10878,15475,-4901);
spawnAMonster(-10649,15476,-4901);
spawnAMonster(-10713,15303,-4901);
spawnAMonster(-10915,15327,-4901);
spawnAMonster(-11159,15334,-4901);
spawnAMonster(-11430,15327,-4901);
spawnAMonster(-11702,15323,-4901);
spawnAMonster(-11973,15321,-4904);
spawnAMonster(-12245,15322,-4901);
spawnAMonster(-12432,15311,-4901);
spawnAMonster(-13151,16587,-4901);
spawnAMonster(-13156,16378,-4901);
spawnAMonster(-13165,16032,-4904);
spawnAMonster(-13172,15683,-4901);
spawnAMonster(-13170,15380,-4901);
spawnAMonster(-13650,15386,-4901);
spawnAMonster(-13644,15560,-4904);
spawnAMonster(-13647,15777,-4901);
spawnAMonster(-13642,16096,-4904);
spawnAMonster(-13637,16399,-4904);
spawnAMonster(-13627,16598,-4901);
spawnAMonster(-13434,16640,-4899);
spawnAMonster(-13356,16553,-4899);
spawnAMonster(-13442,16471,-4899);
spawnAMonster(-13363,16398,-4899);
spawnAMonster(-13450,16313,-4899);
spawnAMonster(-13358,16087,-4899);
spawnAMonster(-13464,15857,-4899);
spawnAMonster(-13322,15688,-4899);
spawnAMonster(-13435,15449,-4899);
spawnAMonster(-13337,15369,-4899);
spawnAMonster(-13591,13299,-4901);
spawnAMonster(-13634,13477,-4902);
spawnAMonster(-13622,13704,-4901);
spawnAMonster(-13481,13743,-4901);
spawnAMonster(-13268,13725,-4901);
spawnAMonster(-13176,13579,-4899);
spawnAMonster(-13274,13501,-4902);
spawnAMonster(-13399,13477,-4902);
spawnAMonster(-14686,13285,-4901);
spawnAMonster(-14470,13318,-4899);
spawnAMonster(-14283,13312,-4901);
spawnAMonster(-14268,13483,-4899);
spawnAMonster(-14290,13681,-4901);
spawnAMonster(-14500,13699,-4902);
spawnAMonster(-14500,13699,-4899);
spawnAMonster(-14649,13685,-4901);
spawnAMonster(-14758,13635,-4901);
spawnAMonster(-14691,13512,-4899);
spawnAMonster(-14450,13528,-4899);
spawnAMonster(-17364,14069,-4901);
spawnAMonster(-17098,14066,-4901);
spawnAMonster(-16800,14060,-4901);
spawnAMonster(-16474,14064,-4901);
spawnAMonster(-16198,14066,-4901);
spawnAMonster(-16128,13911,-4899);
spawnAMonster(-16130,13673,-4901);
spawnAMonster(-16210,13569,-4901);
spawnAMonster(-16452,13573,-4901);
spawnAMonster(-16812,13571,-4901);
spawnAMonster(-17179,13575,-4901);
spawnAMonster(-17336,13636,-4901);
spawnAMonster(-17321,13770,-4899);
spawnAMonster(-17214,13710,-4901);
spawnAMonster(-17100,13842,-4899);
spawnAMonster(-16888,13755,-4899);
spawnAMonster(-16648,13907,-4899);
spawnAMonster(-16394,13725,-4899);
spawnAMonster(-16305,13812,-4899);
spawnAMonster(-16149,13890,-4899);
spawnAMonster(-9002,16838,-4901);
spawnAMonster(-8806,16916,-4899);
spawnAMonster(-8534,16951,-4901);
spawnAMonster(-8513,16817,-4901);
spawnAMonster(-8523,16555,-4904);
spawnAMonster(-8541,16284,-4901);
spawnAMonster(-8541,16016,-4901);
spawnAMonster(-8541,15753,-4901);
spawnAMonster(-8685,15750,-4899);
spawnAMonster(-8836,15809,-4899);
spawnAMonster(-9010,15783,-4901);
spawnAMonster(-9008,15957,-4904);
spawnAMonster(-8956,16210,-4901);
spawnAMonster(-8872,16380,-4901);
spawnAMonster(-8970,16575,-4901);
spawnAMonster(-8952,16836,-4901);
spawnAMonster(-8733,16556,-4899);
spawnAMonster(-8757,16276,-4899);
spawnAMonster(-11442,13274,-4901);
spawnAMonster(-11252,13230,-4901);
spawnAMonster(-11143,13336,-4901);
spawnAMonster(-10879,13227,-4901);
spawnAMonster(-10767,13373,-4901);
spawnAMonster(-10470,13246,-4904);
spawnAMonster(-10324,13377,-4901);
spawnAMonster(-10197,13241,-4901);
spawnAMonster(-10206,13580,-4899);
spawnAMonster(-10347,13751,-4901);
spawnAMonster(-10408,13656,-4901);
spawnAMonster(-10589,13725,-4901);
spawnAMonster(-10745,13613,-4901);
spawnAMonster(-10879,13744,-4901);
spawnAMonster(-11007,13626,-4901);
spawnAMonster(-11182,13741,-4901);
spawnAMonster(-11325,13649,-4901);
spawnAMonster(-11428,13759,-4901);
spawnAMonster(-11373,13536,-4899);
spawnAMonster(-10902,13486,-4902);
spawnAMonster(-10545,13494,-4899);
spawnAMonster(-8862,21453,-4901);
spawnAMonster(-9049,21526,-4901);
spawnAMonster(-9144,21433,-4901);
spawnAMonster(-9305,21484,-4901);
spawnAMonster(-9391,21424,-4901);
spawnAMonster(-9539,21520,-4901);
spawnAMonster(-9673,21453,-4901);
spawnAMonster(-9823,21526,-4901);
spawnAMonster(-9914,21396,-4901);
spawnAMonster(-10016,21606,-4899);
spawnAMonster(-9904,21689,-4899);
spawnAMonster(-10045,21896,-4901);
spawnAMonster(-9896,21868,-4901);
spawnAMonster(-9746,21864,-4901);
spawnAMonster(-9611,21799,-4901);
spawnAMonster(-9485,21875,-4901);
spawnAMonster(-9365,21806,-4901);
spawnAMonster(-9231,21902,-4901);
spawnAMonster(-9126,21808,-4901);
spawnAMonster(-8957,21898,-4901);
spawnAMonster(-8878,21793,-4901);
spawnAMonster(-8760,21905,-4901);
spawnAMonster(-8906,21661,-4899);
spawnAMonster(-9198,21676,-4899);
spawnAMonster(-9422,21603,-4899);
spawnAMonster(-9657,21693,-4899);
spawnAMonster(-9903,21620,-4899);
spawnAMonster(-11922,21748,-4901);
spawnAMonster(-12077,21835,-4901);
spawnAMonster(-12368,21708,-4901);
spawnAMonster(-12554,21825,-4901);
spawnAMonster(-12829,21755,-4901);
spawnAMonster(-13060,21859,-4901);
spawnAMonster(-13333,21762,-4901);
spawnAMonster(-13494,21874,-4901);
spawnAMonster(-13492,22142,-4901);
spawnAMonster(-13305,22240,-4904);
spawnAMonster(-13163,22139,-4901);
spawnAMonster(-12879,22237,-4901);
spawnAMonster(-12795,22108,-4901);
spawnAMonster(-12610,22301,-4901);
spawnAMonster(-12271,22335,-4904);
spawnAMonster(-12231,22199,-4901);
spawnAMonster(-11991,22111,-4904);
spawnAMonster(-11771,22210,-4904);
spawnAMonster(-11803,22033,-4899);
spawnAMonster(-12354,21958,-4900);
spawnAMonster(-12851,21975,-4899);
spawnAMonster(-13319,21959,-4902);
spawnAMonster(-13196,23624,-4901);
spawnAMonster(-13359,23567,-4899);
spawnAMonster(-13567,23567,-4901);
spawnAMonster(-13551,23700,-4904);
spawnAMonster(-13574,23834,-4899);
spawnAMonster(-13566,23994,-4904);
spawnAMonster(-13429,24069,-4899);
spawnAMonster(-13326,24011,-4899);
spawnAMonster(-13193,23980,-4901);
spawnAMonster(-13163,23823,-4902);
spawnAMonster(-13277,23788,-4899);
spawnAMonster(-13406,23747,-4899);
spawnAMonster(-13396,23911,-4899);
spawnAMonster(-10148,23774,-4901);
spawnAMonster(-10143,23514,-4901);
spawnAMonster(-10151,23210,-4901);
spawnAMonster(-10159,22950,-4901);
spawnAMonster(-10165,22681,-4901);
spawnAMonster(-10337,22558,-4899);
spawnAMonster(-10438,22570,-4899);
spawnAMonster(-10572,22599,-4901);
spawnAMonster(-10600,22729,-4901);
spawnAMonster(-10541,22988,-4901);
spawnAMonster(-10604,23202,-4901);
spawnAMonster(-10506,23475,-4901);
spawnAMonster(-10608,23600,-4901);
spawnAMonster(-10492,23808,-4901);
spawnAMonster(-10410,23645,-4899);
spawnAMonster(-10419,23481,-4899);
spawnAMonster(-10395,23234,-4899);
spawnAMonster(-10404,22948,-4899);
spawnAMonster(-10402,22682,-4899);
spawnAMonster(-10301,22776,-4899);
spawnAMonster(-14530,15329,-4901);
spawnAMonster(-14813,15324,-4901);
spawnAMonster(-15073,15223,-4901);
spawnAMonster(-15953,15198,-4901);
spawnAMonster(-15812,15093,-4901);
spawnAMonster(-15624,15169,-4901);
spawnAMonster(-15464,15125,-4901);
spawnAMonster(-15293,15195,-4901);
spawnAMonster(-15160,15119,-4901);
spawnAMonster(-14986,15067,-4901);
spawnAMonster(-15313,14930,-4899);
spawnAMonster(-15741,14897,-4899);
spawnAMonster(-15876,14701,-4901);
spawnAMonster(-15405,14705,-4901);
spawnAMonster(-15305,14819,-4901);
spawnAMonster(-15145,14741,-4901);
spawnAMonster(-14805,14816,-4901);
spawnAMonster(-14730,14714,-4901);
spawnAMonster(-14454,14831,-4901);
spawnAMonster(-14330,14716,-4901);
spawnAMonster(-14519,14899,-4899);
spawnAMonster(-15886,14937,-4899);
spawnAMonster(-18178,14823,-4901);
spawnAMonster(-18046,14828,-4901);
spawnAMonster(-17891,14827,-4899);
spawnAMonster(-17717,14821,-4901);
spawnAMonster(-17804,14690,-4899);
spawnAMonster(-17927,14652,-4899);
spawnAMonster(-18068,14629,-4899);
spawnAMonster(-18100,14446,-4901);
spawnAMonster(-17947,14411,-4899);
spawnAMonster(-17808,14421,-4901);
spawnAMonster(-17705,14425,-4901);
spawnAMonster(-17750,14618,-4899);
spawnAMonster(-17765,14739,-4901);
spawnAMonster(-17744,14871,-4901);
spawnAMonster(-17621,14657,-4899);
spawnAMonster(-16577,16419,-4901);
spawnAMonster(-16382,16371,-4901);
spawnAMonster(-16259,16422,-4901);
spawnAMonster(-16065,16362,-4901);
spawnAMonster(-15902,16411,-4901);
spawnAMonster(-15734,16348,-4901);
spawnAMonster(-15640,16442,-4901);
spawnAMonster(-15335,16512,-4901);
spawnAMonster(-15389,16132,-4899);
spawnAMonster(-15535,15971,-4901);
spawnAMonster(-15656,16072,-4901);
spawnAMonster(-15812,15983,-4901);
spawnAMonster(-15923,16100,-4901);
spawnAMonster(-16094,15958,-4901);
spawnAMonster(-16206,16067,-4901);
spawnAMonster(-16382,15937,-4901);
spawnAMonster(-16461,16065,-4901);
spawnAMonster(-16640,15948,-4901);
spawnAMonster(-16537,16225,-4899);
spawnAMonster(-16277,16218,-4899);
spawnAMonster(-16020,16220,-4899);
spawnAMonster(-15813,16223,-4899);
spawnAMonster(-15517,16226,-4899);
spawnAMonster(-15296,16224,-4899);
spawnAMonster(-14148,18098,-4899);
spawnAMonster(-14148,18098,-4899);
spawnAMonster(-10456,17886,-4901);
spawnAMonster(-10631,17966,-4901);
spawnAMonster(-10850,17848,-4901);
spawnAMonster(-10946,17960,-4901);
spawnAMonster(-11153,17861,-4901);
spawnAMonster(-11319,17969,-4901);
spawnAMonster(-11479,17859,-4901);
spawnAMonster(-11551,17944,-4901);
spawnAMonster(-11657,17838,-4901);
spawnAMonster(-11642,18251,-4901);
spawnAMonster(-11607,18370,-4901);
spawnAMonster(-11465,18346,-4901);
spawnAMonster(-11403,18214,-4901);
spawnAMonster(-11302,18336,-4901);
spawnAMonster(-11210,18200,-4899);
spawnAMonster(-11095,18356,-4901);
spawnAMonster(-11001,18218,-4901);
spawnAMonster(-10906,18327,-4901);
spawnAMonster(-10815,18249,-4901);
spawnAMonster(-10648,18377,-4901);
spawnAMonster(-10574,18220,-4901);
spawnAMonster(-10422,18366,-4901);
spawnAMonster(-10465,18172,-4899);
spawnAMonster(-10752,18132,-4899);
spawnAMonster(-11028,18126,-4899);
spawnAMonster(-11296,18113,-4899);
spawnAMonster(-11560,18114,-4899);
spawnAMonster(-8563,14763,-4901);
spawnAMonster(-8716,14725,-4899);
spawnAMonster(-8827,14767,-4899);
spawnAMonster(-8931,14747,-4901);
spawnAMonster(-9041,14736,-4901);
spawnAMonster(-9009,14451,-4901);
spawnAMonster(-8906,14423,-4901);
spawnAMonster(-8802,14397,-4899);
spawnAMonster(-8668,14373,-4901);
spawnAMonster(-8535,14436,-4901);
spawnAMonster(-8990,14387,-4901);
spawnAMonster(-8890,14452,-4901);
spawnAMonster(-8911,14552,-4899);
spawnAMonster(-8951,14662,-4899);
spawnAMonster(-9004,14825,-4901);
spawnAMonster(-8809,14805,-4899);
spawnAMonster(-13386,15834,-4899);
spawnAMonster(-13534,15746,-4901);
spawnAMonster(-13536,13596,-4901);
spawnAMonster(-15484,14892,-4899);
spawnAMonster(-15468,15057,-4901);
spawnAMonster(-14920,14952,-4899);
spawnAMonster(-14419,15071,-4901);
spawnAMonster(-14604,15134,-4901);
spawnAMonster(-15755,16249,-4899);
spawnAMonster(-9027,13275,-4901);
spawnAMonster(-8818,13327,-4899);
spawnAMonster(-8710,13331,-4899);
spawnAMonster(-8628,13292,-4901);
spawnAMonster(-8571,13478,-4899);
spawnAMonster(-8797,13622,-4899);
spawnAMonster(-8931,13704,-4901);
spawnAMonster(-8929,13593,-4901);

}
}

AdminDarkOmen.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.admincommandhandlers;

import java.util.logging.Logger;

import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.instancemanager.DarkOmenEventManager;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
 * This class handles following admin commands: <li>add_exp_sp_to_character <i>shows menu for add or remove</i> <li>add_exp_sp exp sp <i>Adds exp & sp to target, displays menu if a parameter is missing</i> <li>remove_exp_sp exp sp <i>Removes exp & sp from target, displays menu if a parameter is
 * missing</i>
 */
public class AdminDarkOmen implements IAdminCommandHandler
{
private static Logger _log = Logger.getLogger(AdminDarkOmen.class.getName());
private static final String[] ADMIN_COMMANDS =
{
"admin_darkopen",
"admin_darkclose"
};

@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.startsWith("admin_darkopen"))
{
DarkOmenEventManager.darkOmenRunning = true;
Announcements.announceToAll("Catacomb of Dark Omen event is now open!"
+ " Go to the special gatekeeper in Gludin and teleport in.");
Announcements.announceToAll("Xp and drop rates are doubled inside. Good Luck.");
DarkOmenEventManager.spawnMonsters();

}
else if (command.startsWith("admin_darkclose"))
{
DarkOmenEventManager.darkOmenRunning = false;
Announcements.announceToAll("Dark Omen Event is now over. Thanks for joining.");
DarkOmenEventManager.despawnMnosters();
}
return true;
}

@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}


}

L2DarkAnakimInstance.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.model.actor.instance;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.util.Rnd;

/**
 * @author Elfocrash
 *
 */
public class L2DarkAnakimInstance extends L2NpcInstance
{
public L2DarkAnakimInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("1"))
{
int chance = Rnd.get(0,1);
if(chance ==0)
player.teleToLocation(-119174,-178007,-6757, 0);
else if(chance ==1)
player.teleToLocation(-119163,-177499,-6757, 0);
}


super.onBypassFeedback(player, command);
}

@Override
public void showChatWindow(L2PcInstance player)
{
NpcHtmlMessage htm = new NpcHtmlMessage(0);
    StringBuilder sb = new StringBuilder("<html><body>");
    sb.append("<center>");
     /*   sb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
        sb.append("<tr>");
        sb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
        sb.append("<td valign=\"top\"><font color=\"FF6600\">Top PvP/PK</font>");
        sb.append("<br1><font color=\"00FF00\">" + player.getName() + "</font>, here you can find the top pvp and pk of our server.<br1></td>");
        sb.append("</tr>");
        sb.append("</table>");*/
       
sb.append("<br><font color=\"FFA500\">" + player.getName() + " you found the path to Dark Omem's End. <br1>You can now challenge on of the two great bosses Anakim. <br1>Are you ready?<br1></font>");

sb.append("<a action=\"bypass -h npc_%objectId%_1\">Teleport to Anakim.</a>");
sb.append("</body></html>");
htm.setHtml(sb.toString());
htm.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(htm);
}
}

L2DarkLilithInstance.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.model.actor.instance;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.util.Rnd;

/**
 * @author Elfocrash
 *
 */
public class L2DarkLilithInstance extends L2NpcInstance
{
public L2DarkLilithInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("1"))
{
int chance = Rnd.get(0,1);
if(chance ==0)
player.teleToLocation(-114119,-174276,-6757, 0);
else if(chance ==1)
player.teleToLocation(-113604,-174273,-6757, 0);
}


super.onBypassFeedback(player, command);
}

@Override
public void showChatWindow(L2PcInstance player)
{
NpcHtmlMessage htm = new NpcHtmlMessage(0);
    StringBuilder sb = new StringBuilder("<html><body>");
    sb.append("<center>");
     /*   sb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
        sb.append("<tr>");
        sb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
        sb.append("<td valign=\"top\"><font color=\"FF6600\">Top PvP/PK</font>");
        sb.append("<br1><font color=\"00FF00\">" + player.getName() + "</font>, here you can find the top pvp and pk of our server.<br1></td>");
        sb.append("</tr>");
        sb.append("</table>");*/
       
sb.append("<br><font color=\"FFA500\">" + player.getName() + " you found the path to Dark Omem's End. <br1>You can now challenge on of the two great bosses Lilith. <br1>Are you ready?<br1></font>");

sb.append("<a action=\"bypass -h npc_%objectId%_1\">Teleport to Lilith.</a>");
sb.append("</body></html>");
htm.setHtml(sb.toString());
htm.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(htm);
}
}

L2DarkOmenInstance.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.model.actor.instance;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;

/**
 * @author Elfocrash
 *
 */
public class L2DarkOmenInstance extends L2NpcInstance
{
public L2DarkOmenInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("1"))
{
player.teleToLocation(-19195, 13501, -4898, 0);
}


super.onBypassFeedback(player, command);
}

@Override
public void showChatWindow(L2PcInstance player)
{
NpcHtmlMessage htm = new NpcHtmlMessage(0);
    StringBuilder sb = new StringBuilder("<html><body>");
    sb.append("<center>");
     /*   sb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
        sb.append("<tr>");
        sb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
        sb.append("<td valign=\"top\"><font color=\"FF6600\">Top PvP/PK</font>");
        sb.append("<br1><font color=\"00FF00\">" + player.getName() + "</font>, here you can find the top pvp and pk of our server.<br1></td>");
        sb.append("</tr>");
        sb.append("</table>");*/
       
sb.append("<br><font color=\"00A5FF\">" + player.getName() + "</font>, <font color=\"FFA500\">the gates of Dark Omen Catacomb are open. <br1>Are you ready to face your inner fears?<br1>"
+ " If you do you can proceed by clicking the <br1>button below. Remember though. There are many<br1> strong enemies inside the Catacomb of Dark Omens"
+ ". <br1>On the other hand they will reward you<br1> greatly for killing them. At the end of the Catacomb <br1> it is said that 2 great enemies live. Find their gates <br1>"
+ "and challenge them. Time to write some history!</font><br1>");

sb.append("<a action=\"bypass -h npc_%objectId%_1\">Enter The Dark Omen.</a>");
sb.append("</body></html>");
htm.setHtml(sb.toString());
htm.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(htm);
}
}

Creditos: Elfocrash
#33
L2 | Eventos / Evento Blessing of Experience
Último mensaje por Swarlog - Jun 28, 2025, 11:55 PM



CitarIntroducción:

Hoy os traigo un evento para Interlude, llamada "Bendición de experiencia." Conozca el evento final Gracia Epilogue, Freya, High Five llamados "Regalo de vitalidad?" Bueno, no lo hacemos Interlude vitalidad, pero sí aumenta la experiencia, por lo que estamos aquí.
Funciona de la misma manera que esta vitalidad hace.

CitarDescripción:

• Script configurable.
• Refuerzo de la experiencia Configurable.
• editable NPC.
• Buff dura 2 horas.
• Al conectar subclases / Die, se retira la piel de ante.
• Icono buff Custom / Descripción / efecto.

CitarCORE

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (revision 2)
+++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -76,12 +76,15 @@
* <li>If the L2PcInstance increases its level, manage the increase level task (Max MP, Max MP, Recommandation, Expertise and beginner skills...)</li>
* <li>If the L2PcInstance increases its level, send UserInfo to the L2PcInstance</li>
* </ul>
- * @param addToExp The Experience value to add
- * @param addToSp The SP value to add
*/
@Override
public boolean addExpAndSp(long addToExp, int addToSp)
{
+ return addExpAndSp(addToExp, addToSp, false);
+ }
+
+ public boolean addExpAndSp(long addToExp, int addToSp, boolean useBonuses)
+ {
float ratioTakenByPet = 0;
// Player is Gm and acces level is below or equal to GM_DONT_TAKE_EXPSP and is in party, don't give Xp/Sp
L2PcInstance activeChar = getActiveChar();
@@ -88,6 +91,18 @@
if (!activeChar.getAccessLevel().canGainExp())
return false;

+ double bonusExp = Config.EXPERIENCE_BLESSING_BONUS;
+ double bonusSp = Config.EXPERIENCE_BLESSING_BONUS;
+
+ if (useBonuses)
+ {
+ bonusExp = getExpBonusMultiplier();
+ bonusSp = getSpBonusMultiplier();
+ }
+
+ addToExp *= bonusExp;
+ addToSp *= bonusSp;
+
// if this player has a pet that takes from the owner's Exp, give the pet Exp now
if (activeChar.hasPet())
{
@@ -381,4 +396,36 @@

return (getRunSpeed() * 70) / 100;
}
+
+ public double getExpBonusMultiplier()
+ {
+ double bonus = 1.0;
+ double bonusExp = 1.0;
+
+ if (bonusExp > 1)
+ {
+ bonus += (bonusExp - 1);
+ }
+
+ bonus = Math.max(bonus, 1);
+ bonus = Math.min(bonus, 3.5);
+
+ return bonus;
+ }
+
+ public double getSpBonusMultiplier()
+ {
+ double bonus = 1.0;
+ double bonusSp = 1.0;
+
+ if (bonusSp > 1)
+ {
+ bonus += (bonusSp - 1);
+ }
+
+ bonus = Math.max(bonus, 1);
+ bonus = Math.min(bonus, 3.5);
+
+ return bonus;
+ }
}
\ No newline at end of file
Index: config/events.properties
===================================================================
--- config/events.properties (revision 2)
+++ config/events.properties (working copy)
@@ -245,4 +245,14 @@
AltFishChampionshipReward2 = 500000
AltFishChampionshipReward3 = 300000
AltFishChampionshipReward4 = 200000
-AltFishChampionshipReward5 = 100000
\ No newline at end of file
+AltFishChampionshipReward5 = 100000
+
+#=============================================================
+# Blessing of Experience
+#=============================================================
+# If the buff 'Blessing of Experience' is active, you can use this
+# configuration to edit the experience multiplier.
+# When you have the effects of 'Blessing of Experience', the experience
+# will be increased 200%.
+# Default: 2.0
+ExperienceBlessingBonus = 2.0
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -9136,12 +9136,19 @@
@Override
public void addExpAndSp(long addToExp, int addToSp)
{
- getStat().addExpAndSp(addToExp, addToSp);
+ if (this.getFirstEffect(7065) != null)
+ {
+ getStat().addExpAndSp(addToExp, addToSp, false);
+ }
+ else
+ {
+ getStat().addExpAndSp(addToExp, addToSp, true);
+ }
}

public void removeExpAndSp(long removeExp, int removeSp)
{
- getStat().removeExpAndSp(removeExp, removeSp);
+ getStat().removeExpAndSp(removeExp, removeSp, true);
}

@Override
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 2)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -223,6 +223,9 @@
public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;

+ /** Blessing of Experience Bonus */
+ public static double EXPERIENCE_BLESSING_BONUS;
+
// --------------------------------------------------
// HexID
// --------------------------------------------------
@@ -875,6 +878,8 @@
ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);

+ EXPERIENCE_BLESSING_BONUS = events.getProperty("ExperienceBlessingBonus", 1.0);
+
// FloodProtector
ExProperties security = load(FLOOD_PROTECTOR_FILE);
loadFloodProtectorConfig(security, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");

CitarPasos de la instalación:

1 - Instalar núcleo parche.
2 - Pegar la APN y skill.xml en distintos archivos que coincidan.
3 - Ir a: Gameserver / data / scripts y crear una carpeta llamada "eventos" y pegar en la carpeta de eventos con el guión allí. El directorio será como: gameserver / data / scripts / eventos / BlessingOfExperience
4 - Poner esta línea: eventos / BlessingOfExperience / BlessingOfExperience.java el archivo: scripts.cfg.
5 - Instale el cliente de parche con L2Fileedit.

Créditos: Colet
#34
L2 | Eventos / Re:Evento Random Fight
Último mensaje por Swarlog - Jun 28, 2025, 11:52 PM
[Evento] Random Fight para Freya/H5

    + ALLOW_RANDOM_FIGHT = players.getProperty("AllowRandomFight",true);
    + EVERY_MINUTES = players.getProperty("EveryMinutes",3);
    + RANDOM_FIGHT_REWARD_ID = players.getProperty("RewardId" , 8762);
    + RANDOM_FIGHT_REWARD_COUNT = players.getProperty("RewardCount" , 5);

Por:

    ALLOW_RANDOM_FIGHT = Boolean.parseBoolean(L2JModSettings.getProperty("AllowRandomFight", "True"));
    EVERY_MINUTES = Integer.parseInt(L2JModSettings.getProperty("EveryMinutes","3"));
    RANDOM_FIGHT_REWARD_ID = Integer.parseInt(L2JModSettings.getProperty("RewardId", "8762"));
    RANDOM_FIGHT_REWARD_COUNT = Integer.parseInt(L2JModSettings.getProperty("RewardCount" , "5"));



p.teleToLocation(82698,148638,-3473,0);
Por esto:

p.teleToLocation(82698,148638,-3473);


void announce(String str)
   {
       Announcements.announceToAll(str);
   }

Y eso por esto otro:

void announce(String str)
   {
       Broadcast.announceToOnlinePlayers(str);
   }
#35
L2 | Eventos / Evento Kratei Cube
Último mensaje por Swarlog - Jun 28, 2025, 11:47 PM
CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2JOfficial
Index: lin2srv/java/net/sf/l2j/gameserver/model/L2World.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/model/L2World.java (revision 1451)
+++ lin2srv/java/net/sf/l2j/gameserver/model/L2World.java (working copy)
@@ -187,6 +187,16 @@
  return time;
  }
 
+ public L2PcInstance findPlayer(int objectId)
+ {
+ L2Object obj = _allObjects.get(objectId);
+
+ if (obj instanceof L2PcInstance)
+ return (L2PcInstance) obj;
+
+ return null;
+ }
+
  /**
   * Added by Tempy - 08 Aug 05
   * Allows easy retrevial of all visible objects in world.
Index: lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 1451)
+++ lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -423,6 +423,8 @@
 
  private boolean _isIn7sDungeon = false;
 
+ private boolean _isInKrateisCube = false;
+
  public int _bookmarkslot = 0; // The Teleport Bookmark Slot
 
  public FastList<TeleportBookmark> tpbookmark = new FastList<TeleportBookmark>();
@@ -11472,7 +11474,20 @@
  _inAirShipPosition = pt;
  }
 
+ public void setIsInKrateisCube(boolean choice)
+ {
+ _isInKrateisCube = choice;
+ }
+
  /**
+  * @return
+  */
+ public boolean getIsInKrateisCube()
+ {
+ return _isInKrateisCube;
+ }
+
+ /**
   * Manage the delete task of a L2PcInstance (Leave Party, Unsummon pet, Save its inventory in the database, Remove it from the world...).<BR><BR>
   *
   * <B><U> Actions</U> :</B><BR><BR>
Index: lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2KrateisCubeManagerInstance.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2KrateisCubeManagerInstance.java (revision 0)
+++ lin2srv/java/net/sf/l2j/gameserver/model/actor/instance/L2KrateisCubeManagerInstance.java (revision 0)
@@ -0,0 +1,120 @@
+/*
+ * 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.model.actor.instance;
+
+import net.sf.l2j.gameserver.instancemanager.KrateisCubeManager;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * @author Psycho(killer1888)
+ */
+public class L2KrateisCubeManagerInstance extends L2NpcInstance
+{
+
+ public L2KrateisCubeManagerInstance(int objectId, L2NpcTemplate template)
+ {
+ super(objectId, template);
+ }
+
+ @Override
+ public void onBypassFeedback(L2PcInstance player, String command)
+ {
+ if (command.startsWith("Register"))
+ {
+ if (player.getInventoryLimit() * 0.8 <= player.getInventory().getSize())
+ {
+ player.sendPacket(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT);
+ showChatWindow(player, "data/html/krateisCube/32503-9.htm");
+ return;
+ }
+
+ boolean canParticipate = true;
+ int cmdChoice = Integer.parseInt(command.substring(9, 10).trim());
+ switch (cmdChoice)
+ {
+ case 1:
+ if (player.getLevel() < 70 || player.getLevel() > 75)
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-7.htm");
+ return;
+ }
+ break;
+ case 2:
+ if (player.getLevel() < 76 || player.getLevel() > 79)
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-7.htm");
+ return;
+ }
+ break;
+ case 3:
+ if (player.getLevel() < 80)
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-7.htm");
+ return;
+ }
+ break;
+ }
+
+ if (KrateisCubeManager.getInstance().isTimeToRegister())
+ {
+ if (KrateisCubeManager.getInstance().registerPlayer(player))
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-4.htm");
+ return;
+ }
+ else
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-5.htm");
+ return;
+ }
+ }
+ else
+ {
+ showChatWindow(player, "data/html/krateisCube/32503-8.htm");
+ return;
+ }
+
+ }
+ else if (command.startsWith("Cancel"))
+ {
+ KrateisCubeManager.getInstance().removePlayer(player);
+ showChatWindow(player, "data/html/krateisCube/32503-6.htm");
+ return;
+ }
+ else if (command.startsWith("TeleportIn"))
+ {
+ KrateisCubeManager.getInstance().teleportPlayerIn(player);
+ return;
+ }
+ else
+ super.onBypassFeedback(player,command);
+ }
+
+ @Override
+ public String getHtmlPath(int npcId, int val)
+ {
+ String pom = "";
+
+ if (val == 0)
+ pom = "" + npcId;
+ else
+ pom = npcId + "-" + val;
+
+ return "data/html/krateisCube/" + pom + ".htm";
+ }
+}
Index: lin2srv/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/GameServer.java (revision 1451)
+++ lin2srv/java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -91,6 +91,7 @@
 import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
 import net.sf.l2j.gameserver.instancemanager.InstanceManager;
 import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
+import net.sf.l2j.gameserver.instancemanager.KrateisCubeManager;
 import net.sf.l2j.gameserver.instancemanager.MercTicketManager;
 import net.sf.l2j.gameserver.instancemanager.PetitionManager;
 import net.sf.l2j.gameserver.instancemanager.QuestManager;
@@ -356,6 +357,9 @@
  if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0)
  ItemsAutoDestroy.getInstance();
 
+ _log.info("Krateis Cube loaded");
+ KrateisCubeManager.getInstance().init();
+
  MonsterRace.getInstance();
 
  SevenSigns.getInstance().spawnSevenSignsNPC();
Index: lin2srv/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 1451)
+++ lin2srv/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -35,6 +35,7 @@
 import net.sf.l2j.gameserver.instancemanager.FortManager;
 import net.sf.l2j.gameserver.instancemanager.FortSiegeManager;
 import net.sf.l2j.gameserver.instancemanager.InstanceManager;
+import net.sf.l2j.gameserver.instancemanager.KrateisCubeManager;
 import net.sf.l2j.gameserver.instancemanager.PetitionManager;
 import net.sf.l2j.gameserver.instancemanager.QuestManager;
 import net.sf.l2j.gameserver.instancemanager.SiegeManager;
@@ -190,6 +191,9 @@
  GmListTable.getInstance().addGm(activeChar, true);
  }
 
+ if (KrateisCubeManager.getInstance().isRegistered(activeChar))
+ activeChar.setIsInKrateisCube(true);
+
  activeChar.setPvpColor();
 
  // Set dead status if applies
Index: lin2srv/java/net/sf/l2j/gameserver/instancemanager/KrateisCubeManager.java
===================================================================
--- lin2srv/java/net/sf/l2j/gameserver/instancemanager/KrateisCubeManager.java (revision 0)
+++ lin2srv/java/net/sf/l2j/gameserver/instancemanager/KrateisCubeManager.java (revision 0)
@@ -0,0 +1,726 @@
+/*
+ * 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.instancemanager;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Calendar;
+//import java.util.Map.Entry;
+import java.util.concurrent.ScheduledFuture;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.DoorTable;
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.L2Character;
+import net.sf.l2j.gameserver.model.actor.L2Npc;
+import net.sf.l2j.gameserver.model.actor.L2Summon;
+import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+import net.sf.l2j.util.Rnd;
+//import net.sf.l2j.util.L2FastSet;
+import net.sf.l2j.util.ValueSortMap;
+
+/**
+ * @author Psycho(killer1888)
+ */
+
+public class KrateisCubeManager
+{
+ protected static final Logger  _log  = Logger.getLogger(KrateisCubeManager.class.getName());
+ private static boolean  _started   = false;
+ private static boolean  _canRegister  = true;
+ private static int  _rotation  = 0;
+ private static int  _level   = 0;
+ protected ScheduledFuture<?>  _rotateRoomTask = null;
+ private static L2Npc _manager;
+ private static int _playersToReward = 0;
+ private static int _playerTotalKill = 0;
+ private static double _playerTotalCoin = 0;
+ private static int _matchDuration = 20;
+ private static int _waitingTime = 3;
+
+ private final FastList<L2Npc>  _watchers = new FastList<L2Npc>();
+ private final FastList<L2Npc>  _mobs = new FastList<L2Npc>();
+ private static FastList<Integer> _players = new FastList<Integer>();
+ private static FastList<Integer> _tempPlayers = new FastList<Integer>();
+ private static Map<Integer, Integer> _killList = new FastMap<Integer, Integer>();
+
+ private static int  _redWatcher  = 18601;
+ private static int  _blueWatcher  = 18602;
+ private static int _fantasyCoin  = 13067;
+
+ private static int[]  _doorlistA  = {17150014,17150013,17150019,17150024,17150039,17150044,17150059,17150064,17150079,17150084,17150093,17150094,17150087,17150088,17150082,17150077,17150062,17150057,17150008,17150007,17150018,17150023,17150038,17150043,17150058,17150063,17150078,17150083,17150030,17150029,17150028,17150027,17150036,17150041,17150056,17150061};
+ private static int[]  _doorlistB  = {17150020,17150025,17150034,17150033,17150032,17150031,17150012,17150011,17150010,17150009,17150017,17150022,17150016,17150021,17150037,17150042,17150054,17150053,17150052,17150051,17150050,17150049,17150048,17150047,17150085,17150080,17150074,17150073,17150072,17150071,17150070,17150069,17150068,17150067,17150076,17150081,17150092,17150091,17150090,17150089};
+
+ private static int[]  _level70Mobs  = {18587,18580,18581,18584,18591,18589,18583};
+ private static int[]  _level76Mobs  = {18590,18591,18589,18585,18586,18583,18592,18582};
+ private static int[]  _level80Mobs  = {18595,18597,18596,18598,18593,18600,18594,18599};
+
+ private static final String GET_PLAYED_MATCH = "SELECT played_matchs, total_kills, total_coins FROM krateis_cube WHERE charId=?";
+ private static final String SAVE_PLAYED_MATCH = "INSERT INTO krateis_cube (charId,played_matchs,total_kills,total_coins) VALUES (?,?,?,?)";
+ private static final String UPDATE_PLAYED_MATCH = "UPDATE krateis_cube SET played_matchs = ?, total_kills = ?, total_coins = ? WHERE charId = ?";
+
+ private static int[][][]  _spawnLocs = {
+ {{-77663, -85716, -8365},{-77701, -85948, -8365},{-77940, -86090, -8365},{-78142, -85934, -8365},{-78180, -85659, -8365}},
+ {{-79653, -85689, -8365},{-79698, -86017, -8365},{-80003, -86025, -8365},{-80102, -85880, -8365},{-80061, -85603, -8365}},
+ {{-81556, -85765, -8365},{-81794, -85528, -8365},{-82111, -85645, -8365},{-82044, -85928, -8364},{-81966, -86116, -8365}},
+ {{-83750, -85882, -8365},{-84079, -86021, -8365},{-84123, -85663, -8365},{-83841, -85748, -8364},{-83951, -86120, -8365}},
+ {{-85785, -85943, -8364},{-86088, -85626, -8365},{-85698, -85678, -8365},{-86154, -85879, -8365},{-85934, -85961, -8365}},
+ {{-85935, -84131, -8365},{-86058, -83921, -8365},{-85841, -83684, -8364},{-86082, -83557, -8365},{-85680, -83816, -8365}},
+ {{-84128, -83747, -8365},{-83877, -83597, -8365},{-83609, -83946, -8365},{-83911, -83955, -8364},{-83817, -83888, -8364}},
+ {{-82039, -83971, -8365},{-81815, -83972, -8365},{-81774, -83742, -8364},{-81996, -83733, -8364},{-82124, -83589, -8365}},
+ {{-80098, -83862, -8365},{-79973, -84058, -8365},{-79660, -83848, -8365},{-79915, -83570, -8365},{-79803, -83832, -8364}},
+ {{-78023, -84066, -8365},{-77869, -83891, -8364},{-77674, -83757, -8365},{-77861, -83540, -8365},{-78107, -83660, -8365}},
+ {{-77876, -82141, -8365},{-77674, -81822, -8365},{-77885, -81607, -8365},{-78078, -81779, -8365},{-78071, -81874, -8365}},
+ {{-79740, -81636, -8365},{-80094, -81713, -8365},{-80068, -82004, -8365},{-79677, -81987, -8365},{-79891, -81734, -8364}},
+ {{-81703, -81748, -8365},{-81857, -81661, -8364},{-82058, -81863, -8365},{-81816, -82011, -8365},{-81600, -81809, -8365}},
+ {{-83669, -82007, -8365},{-83815, -81965, -8365},{-84121, -81805, -8365},{-83962, -81626, -8365},{-83735, -81625, -8365}},
+ {{-85708, -81838, -8365},{-86062, -82009, -8365},{-86129, -81814, -8365},{-85957, -81634, -8365},{-85929, -81460, -8365}},
+ {{-86160, -79933, -8365},{-85766, -80061, -8365},{-85723, -79691, -8365},{-85922, -79623, -8365},{-85941, -79879, -8364}},
+ {{-84082, -79638, -8365},{-83923, -80082, -8365},{-83687, -79778, -8365},{-83863, -79619, -8365},{-83725, -79942, -8365}},
+ {{-81963, -80020, -8365},{-81731, -79707, -8365},{-81957, -79589, -8365},{-82151, -79788, -8365},{-81837, -79868, -8364}},
+ {{-80093, -80020, -8365},{-80160, -79716, -8365},{-79727, -79699, -8365},{-79790, -80049, -8365},{-79942, -79594, -8365}},
+ {{-78113, -79658, -8365},{-77967, -80022, -8365},{-77692, -79779, -8365},{-77728, -79603, -8365},{-78078, -79857, -8365}},
+ {{-77648, -77923, -8365},{-77714, -77742, -8365},{-78109, -77640, -8365},{-78114, -77904, -8365},{-77850, -77816, -8364}},
+ {{-79651, -77492, -8365},{-79989, -77613, -8365},{-80134, -77981, -8365},{-79759, -78011, -8365},{-79644, -77779, -8365}},
+ {{-81672, -77966, -8365},{-81867, -77536, -8365},{-82129, -77926, -8365},{-82057, -78064, -8365},{-82114, -77608, -8365}},
+ {{-83938, -77574, -8365},{-84129, -77924, -8365},{-83909, -78111, -8365},{-83652, -78006, -8365},{-83855, -77756, -8364}},
+ {{-85660, -78078, -8365},{-85842, -77649, -8365},{-85989, -77556, -8365},{-86075, -77783, -8365},{-86074, -78132, -8365}}};
+
+ private static int[][]  _teleports = {
+ {-77906, -85809, -8362},
+ {-79903, -85807, -8364},
+ {-81904, -85807, -8364},
+ {-83901, -85806, -8364},
+ {-85903, -85807, -8364},
+ {-77904, -83808, -8364},
+ {-79904, -83807, -8364},
+ {-81905, -83810, -8364},
+ {-83903, -83807, -8364},
+ {-85899, -83807, -8364},
+ {-77903, -81808, -8364},
+ {-79906, -81807, -8364},
+ {-81901, -81808, -8364},
+ {-83905, -81805, -8364},
+ {-85907, -81809, -8364},
+ {-77904, -79807, -8364},
+ {-79905, -79807, -8364},
+ {-81908, -79808, -8364},
+ {-83907, -79806, -8364},
+ {-85912, -79806, -8364},
+ {-77905, -77808, -8364},
+ {-79902, -77805, -8364},
+ {-81904, -77808, -8364},
+ {-83904, -77808, -8364},
+ {-85904, -77807, -8364}};
+
+ public static final KrateisCubeManager getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ public void init()
+ {
+ Calendar cal = Calendar.getInstance();
+
+ if (cal.get(Calendar.MINUTE) >= 57)
+ {
+ cal.add(Calendar.HOUR, 1);
+ cal.set(Calendar.MINUTE, 27);
+ }
+ else if (cal.get(Calendar.MINUTE) >= 0 && cal.get(Calendar.MINUTE) <= 26)
+ cal.set(Calendar.MINUTE, 27);
+ else
+ cal.set(Calendar.MINUTE, 57);
+
+ cal.set(Calendar.SECOND, 0);
+
+ ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new checkRegistered(), cal.getTimeInMillis() - System.currentTimeMillis(), 30*60*1000);
+
+ Date date = new Date(cal.getTimeInMillis());
+ _log.info("Krateis Cube initialized, next match: " + date);
+ }
+
+ protected class checkRegistered implements Runnable
+ {
+ public void run()
+ {
+ if (!_started)
+ {
+ if (_tempPlayers.isEmpty())
+ {
+ _log.info("Krateis Cube: Match canceled due to lack of participant, next round in 30 minutes.");
+ return;
+ }
+ else
+ {
+ _log.info("Krateis Cube: Match started.");
+ _canRegister = false;
+ teleportToWaitRoom();
+ }
+ }
+ }
+ }
+
+ protected class startKrateisCube implements Runnable
+ {
+ public void run()
+ {
+ _canRegister = true;
+
+ closeAllDoors();
+
+ L2PcInstance player;
+ int i = 0;
+ for (int objectId : _players)
+ {
+ player = L2World.getInstance().findPlayer(objectId);
+ if (player != null)
+ {
+ doTeleport(player, _teleports[i][0], _teleports[i][1], _teleports[i][2]);
+ i++;
+ }
+ }
+
+ L2Spawn spawnDat;
+ spawnDat = spawnNpc(32504, -86804, -81974, -8361, 34826, 60, 0);
+ _manager = spawnDat.doSpawn();
+
+ _rotateRoomTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new rotateRooms(), 10000, 50000);
+ ThreadPoolManager.getInstance().scheduleGeneral(new spawnMobs(), 10000);
+ ThreadPoolManager.getInstance().scheduleGeneral(new finishCube(), _matchDuration*60*1000);
+ }
+ }
+
+ protected class finishCube implements Runnable
+ {
+ public void run()
+ {
+ L2PcInstance player;
+
+ _log.info("Krateis Cube match ended.");
+
+ if (_rotateRoomTask != null)
+ _rotateRoomTask.cancel(true);
+
+ closeAllDoors();
+ globalDespawn();
+ rewardPlayers();
+
+ for (int objectId : _players)
+ {
+ player = L2World.getInstance().findPlayer(objectId);
+ if (player != null)
+ {
+ doTeleport(player, -70381, -70937, -1428);
+ player.setIsInKrateisCube(false);
+ }
+ }
+
+ _killList.clear();
+ _players.clear();
+ _started = false;
+ }
+ }
+
+ protected class spawnMobs implements Runnable
+ {
+ public void run()
+ {
+ int npcId;
+ int _instanceId = 0;
+ L2Spawn spawnDat;
+
+ for (int i = 0; i <= 24; i++)
+ {
+ for (int j = 0; j <= 4; j++)
+ {
+ npcId = _level76Mobs[Rnd.get(_level76Mobs.length)];
+ spawnDat = spawnNpc(npcId, _spawnLocs[i][j][0], _spawnLocs[i][j][1], _spawnLocs[i][j][2], 0, 60, _instanceId);
+ _mobs.add(spawnDat.doSpawn());
+ }
+
+ }
+ }
+ }
+
+ protected class rotateRooms implements Runnable
+ {
+ public void run()
+ {
+ L2Spawn spawnDat;
+ int instanceId = 0;
+ int watcherA;
+ int watcherB;
+
+ watcherA = (_rotation == 0) ? _blueWatcher : _redWatcher;
+ watcherB = (_rotation == 0) ? _redWatcher : _blueWatcher;
+
+ spawnDat = spawnNpc(watcherA, -77906, -85809, -8362, 34826, 60, instanceId); //1
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -79903, -85807, -8364, 32652, 60, instanceId); //2
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -81904, -85807, -8364, 32839, 60, instanceId); //3
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -83901, -85806, -8364, 33336, 60, instanceId); //4
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -85903, -85807, -8364, 32571, 60, instanceId); //5
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -77904, -83808, -8364, 32933, 60, instanceId); //6
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -79904, -83807, -8364, 33055, 60, instanceId); //7
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -81905, -83810, -8364, 32767, 60, instanceId); //8
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -83903, -83807, -8364, 32676, 60, instanceId); //9
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -85899, -83807, -8364, 33005, 60, instanceId); //10
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -77903, -81808, -8364, 32664, 60, instanceId); //11
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -79906, -81807, -8364, 32647, 60, instanceId); //12
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -81901, -81808, -8364, 33724, 60, instanceId); //13
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -83905, -81805, -8364, 32926, 60, instanceId); //14
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -85907, -81809, -8364, 34248, 60, instanceId); //15
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -77904, -79807, -8364, 32905, 60, instanceId); //16
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -79905, -79807, -8364, 32767, 60, instanceId); //17
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -81908, -79808, -8364, 32767, 60, instanceId); //18
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -83907, -79806, -8364, 32767, 60, instanceId); //19
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -85912, -79806, -8364, 29025, 60, instanceId); //20
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -77905, -77808, -8364, 32767, 60, instanceId); //21
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -79902, -77805, -8364, 32767, 60, instanceId); //22
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherB, -81904, -77808, -8364, 32478, 60, instanceId); //23
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -83904, -77808, -8364, 32698, 60, instanceId); //24
+ _watchers.add(spawnDat.doSpawn());
+ spawnDat = spawnNpc(watcherA, -85904, -77807, -8364, 32612, 60, instanceId); //25
+ _watchers.add(spawnDat.doSpawn());
+
+ openDoors();
+
+ _rotation = (_rotation == 0) ? 1 : 0;
+ }
+ }
+
+ protected class CloseDoors implements Runnable
+ {
+ public void run()
+ {
+ closeAllDoors();
+
+ for (L2Npc npc : _watchers)
+ {
+ npc.getSpawn().stopRespawn();
+ npc.deleteMe();
+ }
+ _watchers.clear();
+ }
+ }
+
+ public boolean teleportToWaitRoom()
+ {
+ if (_tempPlayers.size() >= 1)
+ {
+ L2PcInstance player;
+ for (int objectId : _tempPlayers)
+ {
+ _players.add(objectId);
+
+ player = L2World.getInstance().findPlayer(objectId);
+ if (player != null)
+ {
+ doTeleport(player, -87028, -81780, -8365);
+ player.setIsInKrateisCube(true);
+ }
+ }
+
+ _tempPlayers.clear();
+ _started = true;
+ ThreadPoolManager.getInstance().scheduleGeneral(new startKrateisCube(), _waitingTime*60*1000);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void rewardPlayers()
+ {
+ int kills = 0;
+ int i = 0;
+ double amount = 0;
+ L2PcInstance player;
+
+ _playersToReward = getNumberPlayerToReward();
+ _killList = ValueSortMap.sortMapByValue(_killList, false);
+
+ for (int objectId : _killList.keySet())
+ {
+ player = L2World.getInstance().findPlayer(objectId);
+ if (player != null)
+ {
+ kills = _killList.get(objectId);
+
+ if (kills >= 10)
+ {
+ amount = getRewardAmount(player, i);
+ int coinAmount = (int)amount;
+ player.addItem("Krateis Cube Reward", _fantasyCoin, coinAmount, player, true);
+ player.getInventory().updateDatabase();
+ i++;
+ }
+ }
+ }
+ _playersToReward = 0;
+ _playerTotalKill = 0;
+ _playerTotalCoin = 0;
+ }
+
+ private double getRewardAmount(L2PcInstance player, int place)
+ {
+ int playedMatchs = getPlayedMatchs(player);
+ int n = Math.round(_playersToReward / 10);
+ double reward;
+
+ if (playedMatchs == 0)
+ {
+ savePlayedMatchs(player);
+ }
+
+ playedMatchs++;
+
+ switch (place)
+ {
+ case 0:
+ reward = Math.floor(20 + (n * 2) + (playedMatchs / 4));
+ if (reward > 50)
+ reward = 50;
+ break;
+ case 1:
+ reward = Math.floor(8 + (n * 2) + (playedMatchs / 4));
+ if (reward > 20)
+ reward = 20;
+ break;
+ default:
+ reward = Math.floor(1 + n + (playedMatchs / 6));
+ if (reward > 5)
+ reward = 5;
+ break;
+ }
+
+ updatePlayedMatchs(player, playedMatchs, reward);
+
+ return reward;
+ }
+
+ public void updatePlayedMatchs(L2PcInstance player, int playedMatchs, double amount)
+ {
+ Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement(UPDATE_PLAYED_MATCH);
+
+ statement.setInt(1, playedMatchs);
+ statement.setInt(2, _playerTotalKill + _killList.get(player.getObjectId()));
+ statement.setDouble(3, _playerTotalCoin + amount);
+ statement.setInt(4, player.getObjectId());
+ statement.execute();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "Could not update character played Krateis Cube matchs: ", e);
+ }
+ finally
+ {
+ try { con.close(); } catch (Exception e) {}
+ }
+ }
+
+ private void savePlayedMatchs(L2PcInstance player)
+ {
+ Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement(SAVE_PLAYED_MATCH);
+
+ statement.setInt(1, player.getObjectId());
+ statement.setInt(2, 0);
+ statement.setInt(3, _killList.get(player.getObjectId()));
+ statement.setDouble(4, 0);
+ statement.execute();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "Could not store character krateis cube played matchs: ", e);
+ }
+ finally
+ {
+ try { con.close(); } catch (Exception e) {}
+ }
+ }
+
+ private int getPlayedMatchs(L2PcInstance player)
+ {
+ Connection con = null;
+ int playedMatchs = 0;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement(GET_PLAYED_MATCH);
+
+ statement.setInt(1, player.getObjectId());
+
+ ResultSet rset = statement.executeQuery();
+ while (rset.next())
+ {
+ playedMatchs = rset.getInt("played_matchs");
+ _playerTotalKill = rset.getInt("total_kills");
+ _playerTotalCoin = rset.getDouble("total_coins");
+ }
+ rset.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "Could not get player total Krateis Cube played matchs: ", e);
+ }
+ finally
+ {
+ try { con.close(); } catch (Exception e) {}
+ }
+ return playedMatchs;
+ }
+
+ private int getNumberPlayerToReward()
+ {
+ int number = 0;
+ int kills = 0;
+
+ for (int objectId : _killList.keySet())
+ {
+ kills = _killList.get(objectId);
+
+ if (kills >= 10)
+ number++;
+ }
+ return number;
+ }
+
+ private void globalDespawn()
+ {
+ for (L2Npc npc : _mobs)
+ {
+ npc.getSpawn().stopRespawn();
+ npc.deleteMe();
+ }
+ _mobs.clear();
+
+ for (L2Npc npc : _watchers)
+ {
+ npc.getSpawn().stopRespawn();
+ npc.deleteMe();
+ }
+
+ _manager.getSpawn().stopRespawn();
+ _manager.deleteMe();
+
+ _manager = null;
+ _watchers.clear();
+ }
+
+ private void openDoors()
+ {
+ int[] doorToOpen = (_rotation == 1) ? _doorlistB : _doorlistA;
+
+ closeAllDoors();
+
+ for (int doorId : doorToOpen)
+ DoorTable.getInstance().getDoor(doorId).openMe();
+
+ ThreadPoolManager.getInstance().scheduleGeneral(new CloseDoors(), 25000);
+ }
+
+ private void closeAllDoors()
+ {
+ int doorId = 17150001;
+
+ while (doorId <= 17150103)
+ {
+ DoorTable.getInstance().getDoor(doorId).closeMe();
+ doorId += 1;
+ }
+ }
+
+ // Teleports player and his summon to given coords
+ private void doTeleport(L2PcInstance player, int x, int y, int z)
+ {
+ if (player.isOnline() == 0)
+ return;
+
+ player.teleToLocation(x, y, z, false);
+
+ L2Summon pet = player.getPet();
+ if (pet != null)
+ pet.teleToLocation(x, y, z, false);
+ }
+
+ private L2Spawn spawnNpc(int npcId, int x, int y, int z, int heading, int respawnTime, int instanceId)
+ {
+ L2NpcTemplate npcTemplate;
+ npcTemplate = NpcTable.getInstance().getTemplate(npcId);
+ L2Spawn spawnDat = null;
+
+ try
+ {
+ spawnDat = new L2Spawn(npcTemplate);
+ spawnDat.setAmount(1);
+ spawnDat.setLocx(x);
+ spawnDat.setLocy(y);
+ spawnDat.setLocz(z);
+ spawnDat.setHeading(heading);
+ spawnDat.setRespawnDelay(respawnTime);
+ spawnDat.setInstanceId(instanceId);
+ SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+ spawnDat.init();
+ spawnDat.startRespawn();
+ if (respawnTime == 0)
+ spawnDat.stopRespawn();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return spawnDat;
+ }
+
+ public boolean registerPlayer(L2PcInstance player)
+ {
+ int objectId = player.getObjectId();
+
+ if (_tempPlayers.contains(objectId) || _tempPlayers.size() >= 25)
+ return false;
+
+ _tempPlayers.add(objectId);
+ return true;
+ }
+
+ public boolean removePlayer(L2PcInstance player)
+ {
+ int objectId = player.getObjectId();
+
+ if (!_tempPlayers.contains(objectId))
+ return false;
+
+ _tempPlayers.remove(objectId);
+ return true;
+ }
+
+ // Add one kill to this player
+ public void addKill(L2PcInstance player)
+ {
+ addKills(player, 1);
+ }
+
+ // Add value kills to this player
+ public boolean addKills(L2PcInstance player, int value)
+ {
+ int objectId = player.getObjectId();
+ int kills = 0;
+
+ if (_players.contains(objectId))
+ {
+ if (_killList.containsKey(objectId))
+ kills = _killList.get(objectId);
+
+ kills += value;
+ _killList.put(objectId, kills);
+ return true;
+ }
+ return false;
+ }
+
+ public int getKills(L2PcInstance player)
+ {
+ int objectId = player.getObjectId();
+ int kills = 0;
+
+ if (_players.contains(objectId))
+ {
+ if (_killList.containsKey(objectId))
+ kills = _killList.get(objectId);
+ }
+
+ return kills;
+ }
+
+ public boolean isTimeToRegister()
+ {
+ return _canRegister;
+ }
+
+ // This one is used to control if the player is registered in Krateis Cube on enterWorld
+ public boolean isRegistered(L2PcInstance player)
+ {
+ int objectId = player.getObjectId();
+
+ if (_players.contains(objectId))
+ return true;
+ return false;
+ }
+
+ // Used to teleport players in the cube from the waiting room after a death
+ public void teleportPlayerIn(L2PcInstance player)
+ {
+ int i = Rnd.get(_teleports.length);
+ doTeleport(player, _teleports[i][0], _teleports[i][1], _teleports[i][2]);
+ }
+
+ @SuppressWarnings("synthetic-access")
+ private static class SingletonHolder
+ {
+ protected static final KrateisCubeManager _instance = new KrateisCubeManager();
+ }
+}
\ No newline at end of file

CitarDATA:

### Eclipse Workspace Patch 1.0
#P L2JOfficial
Index: data/tools/full_install.sql
===================================================================
--- data/tools/full_install.sql (revision 1451)
+++ data/tools/full_install.sql (working copy)
@@ -71,6 +71,7 @@
 DROP TABLE IF EXISTS items;
 DROP TABLE IF EXISTS itemsonground;
 DROP TABLE IF EXISTS kamaloka;
+DROP TABLE IF EXISTS krateis_cube;
 DROP TABLE IF EXISTS locations;
 DROP TABLE IF EXISTS lvlupgain;
 DROP TABLE IF EXISTS mapregion;
Index: data/sql/npc.sql
===================================================================
--- data/sql/npc.sql (revision 1451)
+++ data/sql/npc.sql (working copy)
@@ -9580,6 +9580,10 @@
 UPDATE `npc` SET `type`='L2Teleporter' WHERE (`id`='32534') LIMIT 1;
 UPDATE `npc` SET `type`='L2Teleporter' WHERE (`id`='32539') LIMIT 1;
 
+-- Krateis Cube Update
+UPDATE `npc` SET `type` = 'L2KrateisCubeManager' WHERE `id` = '32503' LIMIT 1;
+UPDATE `npc` SET `type` = 'L2KrateisCubeManager' WHERE `id` = '32504' LIMIT 1;
+
 -- Alegria Creation Day Celebration Helper
 UPDATE `npc` SET `collision_radius`='5', `collision_height`='21' WHERE `id`='32600';
 
Index: data/data/scripts.cfg
===================================================================
--- data/data/scripts.cfg (revision 1451)
+++ data/data/scripts.cfg (working copy)
@@ -623,6 +623,12 @@
 #instances/Hellbound/Town.py
 #teleports/1107_enter_hellbound_island/__init__.py
 
+
+# Krateis Cube
+handlers/admincommandhandlers/AdminKrateisCube.java
+ai/group_template/KrateisCubeMobs.py
+
+
 # Handlers
 
 # handlers/admincommandhandlers:
Index: data/data/scripts/handlers/admincommandhandlers/AdminKrateisCube.java
===================================================================
--- data/data/scripts/handlers/admincommandhandlers/AdminKrateisCube.java (revision 0)
+++ data/data/scripts/handlers/admincommandhandlers/AdminKrateisCube.java (revision 0)
@@ -0,0 +1,134 @@
+/*
+ * 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 net.sf.l2j.gameserver.handler.model.AAdminCommandHandler;
+import net.sf.l2j.gameserver.instancemanager.KrateisCubeManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Psycho(killer1888)
+ */
+
+public class AdminKrateisCube extends AAdminCommandHandler
+{
+ private static int _kills = 0;
+
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_start_krateis_cube",
+ "admin_stop_krateis_cube",
+ "admin_register_krateis_cube",
+ "admin_unregister_krateis_cube",
+ "admin_add_krateis_cube_kills",
+ "admin_remove_krateis_cube_kills",
+ "admin_get_krateis_cube_kills"
+ };
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ StringTokenizer st = new StringTokenizer(command, " ");
+ String cmd = st.nextToken();
+
+ if (cmd.equals("admin_start_krateis_cube"))
+ {
+ if (!KrateisCubeManager.getInstance().teleportToWaitRoom())
+ activeChar.sendMessage("Not enough registered to start Krateis Cube.");
+ return true;
+ }
+ /*else if (cmd.equals("stop_krateis_cube"))
+ {
+ new finishCube();
+ return true;
+ }*/
+
+ if (activeChar.getTarget() instanceof L2PcInstance)
+ {
+ L2PcInstance target;
+ target = (L2PcInstance) activeChar.getTarget();
+
+ if (cmd.equals("admin_register_krateis_cube"))
+ {
+ if (!KrateisCubeManager.getInstance().registerPlayer(target))
+ activeChar.sendMessage("This player is already registered.");
+ else
+ {
+ if (target == activeChar)
+ activeChar.sendMessage("You have successfully registered for the next Krateis Cube match.");
+ else
+ target.sendMessage("An admin registered you for the next Krateis Cube match.");
+ }
+ }
+ else if (cmd.equals("admin_unregister_krateis_cube"))
+ {
+ if (!KrateisCubeManager.getInstance().removePlayer(target))
+ activeChar.sendMessage("This player is not registered.");
+ else
+ {
+ target.sendMessage("An admin removed you from Krateis Cube playerlist.");
+ }
+ }
+ else if (cmd.equals("admin_add_krateis_cube_kills"))
+ {
+ try
+ {
+ _kills = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ activeChar.sendMessage("Please specify the kills amount you want to add.");
+ }
+
+ if (KrateisCubeManager.getInstance().addKills(target, _kills))
+ {
+ target.sendMessage("An admin added " + _kills + " kills to your Krateis Cube kills.");
+ activeChar.sendMessage("Added " + _kills + " kills to the player.");
+ }
+ else
+ {
+ activeChar.sendMessage("This player does not exist in Krateis Cube playerlist.");
+ }
+ }
+ else if (cmd.equals("admin_get_krateis_cube_kills"))
+ {
+ if (!KrateisCubeManager.getInstance().isRegistered(target))
+ activeChar.sendMessage("This player is not registered.");
+ else
+ {
+ _kills = KrateisCubeManager.getInstance().getKills(target);
+ activeChar.sendMessage("Player Krateis Cube kills: " + _kills + ".");
+ }
+ }
+ return true;
+ }
+ else
+ {
+ activeChar.sendMessage("Target must be a player!");
+ return false;
+ }
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+
+ public static void main(String[] args)
+ {
+ new AdminKrateisCube();
+ }
+}
Index: data/tools/database_installer.sh
===================================================================
--- data/tools/database_installer.sh (revision 1451)
+++ data/tools/database_installer.sh (working copy)
@@ -334,6 +334,7 @@
 $MYG < ../sql/items.sql &> /dev/null
 $MYG < ../sql/itemsonground.sql &> /dev/null
 $MYG < ../sql/kamaloka.sql &> /dev/null
+$MYG < ../sql/krateis_cube.sql &> /dev/null
 $MYG < ../sql/locations.sql &> /dev/null
 $MYG < ../sql/lvlupgain.sql &> /dev/null
 $MYG < ../sql/mapregion.sql &> /dev/null
Index: data/sql/krateis_cube.sql
===================================================================
--- data/sql/krateis_cube.sql (revision 0)
+++ data/sql/krateis_cube.sql (revision 0)
@@ -0,0 +1,7 @@
+CREATE TABLE IF NOT EXISTS `krateis_cube` (
+  `charId` int(10) NOT NULL,
+  `played_matchs` int(10) NOT NULL,
+  `total_kills` int(10) NOT NULL,
+  `total_coins` double(10,0) NOT NULL DEFAULT '0',
+  PRIMARY KEY  (`charId`)
+) DEFAULT CHARSET=utf8;
\ No newline at end of file
Index: data/data/scripts/ai/group_template/KrateisCubeMobs.py
===================================================================
--- data/data/scripts/ai/group_template/KrateisCubeMobs.py (revision 0)
+++ data/data/scripts/ai/group_template/KrateisCubeMobs.py (revision 0)
@@ -0,0 +1,20 @@
+# By Psycho(killer1888)
+import sys
+from net.sf.l2j.gameserver.instancemanager        import KrateisCubeManager
+from net.sf.l2j.gameserver.model.quest.jython     import QuestJython as JQuest
+
+class KrateisCubeMobs (JQuest) :
+
+ def __init__(self,id,name,descr):
+ JQuest.__init__(self,id,name,descr)
+
+ def onKill(self,npc,player,isPet):
+ KrateisCubeManager.getInstance().addKill(player)
+ return
+
+QUEST = KrateisCubeMobs(-1,"KrateisCubeMobs","ai")
+
+i = 18579
+while i <= 18602:
+ QUEST.addKillId(i)
+ i += 1
\ No newline at end of file
Index: data/tools/database_installer.bat
===================================================================
--- data/tools/database_installer.bat (revision 1451)
+++ data/tools/database_installer.bat (working copy)
@@ -582,6 +582,7 @@
 items.sql
 itemsonground.sql
 kamaloka.sql
+krateis_cube.sql
 locations.sql
 lvlupgain.sql
 mapregion.sql
Index: data/data/html/krateisCube/32504.htm
===================================================================
--- data/data/html/krateisCube/32504.htm (revision 0)
+++ data/data/html/krateisCube/32504.htm (revision 0)
@@ -0,0 +1,3 @@
+<html><body>Kratei's Cube Match Manager:<br>
+<a action="bypass -h npc_%objectId%_TeleportIn">Teleport me inside again!</a>
+</body></html>
\ No newline at end of file
Index: data/data/instances/krateisCube.xml
===================================================================
--- data/data/instances/krateisCube.xml (revision 0)
+++ data/data/instances/krateisCube.xml (revision 0)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Psycho -->
+<!-- Cube limit x+:-77304 x-:-86503 y+:-77208 y-:-86407 Room are 1199 square sided and have 2000 offset -->
+<list>
+  <zone id="1" name="Kratei's Cube Room 1" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4468,2" removeExit="4468"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77304" y="-86407"/>
+      <point x="-78503" y="-85208"/>
+    </shape>
+  </zone>
+  <zone id="2" name="Kratei's Cube Room 2" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4644,2" removeExit="4644"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-79304" y="-86407"/>
+      <point x="-80503" y="-85208"/>
+    </shape>
+  </zone>
+  <zone id="3" name="Kratei's Cube Room 3" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4145,3" removeExit="4145"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-81304" y="-86407"/>
+      <point x="-82503" y="-85208"/>
+    </shape>
+  </zone>
+  <zone id="4" name="Kratei's Cube Room 4" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4648,2" removeExit="4648"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-83304" y="-86407"/>
+      <point x="-84503" y="-85208"/>
+    </shape>
+  </zone>
+  <zone id="5" name="Kratei's Cube Room 5" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4646,2" removeExit="4646"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-85304" y="-86407"/>
+      <point x="-86503" y="-85208"/>
+    </shape>
+  </zone>
+  <zone id="6" name="Kratei's Cube Room 6" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4150,6" removeExit="4150"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77304" y="-84407"/>
+      <point x="-78503" y="-83208"/>
+    </shape>
+  </zone>
+  <zone id="7" name="Kratei's Cube Room 7" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4648,2" removeExit="4648"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-79304" y="-84407"/>
+      <point x="-80503" y="-83208"/>
+    </shape>
+  </zone>
+  <zone id="8" name="Kratei's Cube Room 8" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4148,5" removeExit="4148"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-81304" y="-84407"/>
+      <point x="-82503" y="-83208"/>
+    </shape>
+  </zone>
+  <zone id="9" name="Kratei's Cube Room 9" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4150,6" removeExit="4150"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-83304" y="-84407"/>
+      <point x="-84503" y="-83208"/>
+    </shape>
+  </zone>
+  <zone id="10" name="Kratei's Cube Room 10" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4148,5" removeExit="4148"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-85304" y="-84407"/>
+      <point x="-86503" y="-83208"/>
+    </shape>
+  </zone>
+  <zone id="11" name="Kratei's Cube Room 11" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4145,3" removeExit="4145"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77304" y="-82407"/>
+      <point x="-78503" y="-81208"/>
+    </shape>
+  </zone>
+  <zone id="12" name="Kratei's Cube Room 12" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4646,2" removeExit="4646"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-79304" y="-82407"/>
+      <point x="-80503" y="-81208"/>
+    </shape>
+  </zone>
+  <zone id="13" name="Kratei's Cube Room 13" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4149,5" removeExit="4149"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-81304" y="-82407"/>
+      <point x="-82503" y="-81208"/>
+    </shape>
+  </zone>
+  <zone id="14" name="Kratei's Cube Room 14" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4646,2" removeExit="4646"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-83304" y="-82407"/>
+      <point x="-84503" y="-81208"/>
+    </shape>
+  </zone>
+  <zone id="15" name="Kratei's Cube Room 15" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4625,5" removeExit="4625"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-85304" y="-82407"/>
+      <point x="-86503" y="-81208"/>
+    </shape>
+  </zone>
+  <zone id="16" name="Kratei's Cube Room 16" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4149,5" removeExit="4149"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77304" y="-80407"/>
+      <point x="-78503" y="-79208"/>
+    </shape>
+  </zone>
+  <zone id="17" name="Kratei's Cube Room 17" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4468,2" removeExit="4468"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-79304" y="-80407"/>
+      <point x="-80503" y="-79208"/>
+    </shape>
+  </zone>
+  <zone id="18" name="Kratei's Cube Room 18" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4625,5" removeExit="4625"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-81304" y="-80407"/>
+      <point x="-82503" y="-79208"/>
+    </shape>
+  </zone>
+  <zone id="19" name="Kratei's Cube Room 19" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4644,2" removeExit="4644"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-83304" y="-80407"/>
+      <point x="-84503" y="-79208"/>
+    </shape>
+  </zone>
+  <zone id="20" name="Kratei's Cube Room 20" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4150,6" removeExit="4150"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-85304" y="-80407"/>
+      <point x="-86503" y="-79208"/>
+    </shape>
+  </zone>
+  <zone id="21" name="Kratei's Cube Room 21" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4698,6" removeExit="4698"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77304" y="-78407"/>
+      <point x="-78503" y="-77208"/>
+    </shape>
+  </zone>
+  <zone id="22" name="Kratei's Cube Room 22" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4646,2" removeExit="4646"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-79304" y="-78407"/>
+      <point x="-80503" y="-77208"/>
+    </shape>
+  </zone>
+  <zone id="23" name="Kratei's Cube Room 23" type="Danger">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4148,5" removeExit="4148"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-81304" y="-78407"/>
+      <point x="-82503" y="-77208"/>
+    </shape>
+  </zone>
+  <zone id="24" name="Kratei's Cube Room 24" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4468,2" removeExit="4468"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-83304" y="-78407"/>
+      <point x="-84503" y="-77208"/>
+    </shape>
+  </zone>
+  <zone id="25" name="Kratei's Cube Room 25" type="Regeneration">
+  <settings exitOnDeath="true" buffRepeat="true" affected="playable"/>
+    <skill applyEnter="4648,2" removeExit="4648"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-85304" y="-78407"/>
+      <point x="-86503" y="-77208"/>
+    </shape>
+  </zone>
+  <zone id="26" name="Kratei's Cube PvP Zone" type="Arena">
+  <settings pvp="Arena"/>
+  <restart_owner x="-87028" y="-81780" z="-8361"/>
+    <shape type="Rect" zMin="-8400" zMax="-8000">
+      <point x="-77200" y="-86600"/>
+      <point x="-86600" y="-77100"/>
+    </shape>
+  </zone>
+  <zone id="27" name="Kratei's Cube Waiting Zone">
+  <settings pvp="Peace"/>
+    <shape type="Rect" zMin="-8500" zMax="-8000">
+      <point x="-86611" y="-81287"/>
+      <point x="-87456" y="-82320"/>
+    </shape>
+  </zone>
+</list>
\ No newline at end of file
#36
L2 | Eventos / Evento Random Fight
Último mensaje por Swarlog - Jun 28, 2025, 11:46 PM
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (working copy)
@@ -17,6 +17,7 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.SystemMessageId;
@@ -60,6 +61,13 @@
            return;
        }
        
+       if(RandomFight.players.contains(player))
+       {
+           player.sendMessage("You can't logout when you are in random fight event.");
+           player.sendPacket(ActionFailed.STATIC_PACKET);
+           return;
+       }
+     
        if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !player.isGM())
        {
            if (Config.DEBUG)
Index: config/players.properties
===================================================================
--- config/players.properties   (revision 1)
+++ config/players.properties   (working copy)
@@ -45,6 +45,15 @@
 # Death Penalty chance if killed by mob (in %), 20 by default
 DeathPenaltyChance = 20
 
+#Random Fight Event
+AllowRandomFight = True
+#Random Fight every how many minutes
+EveryMinutes = 3
+#ID of the reward Item , default:LIFE STONES
+RewardId=8762
+#COUNT of the reward item : default : 5
+RewardCount = 5
+
 #=============================================================
 #                      Inventory / Warehouse
 #=============================================================
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java  (revision 1)
+++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
@@ -90,6 +90,7 @@
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.PartyMatchRoomList;
 import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.entity.Castle;
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -237,6 +238,9 @@
        Olympiad.getInstance();
        Hero.getInstance();
        
+       if(Config.ALLOW_RANDOM_FIGHT)
+           RandomFight.getInstance();
+     
        Util.printSection("Four Sepulchers");
        FourSepulchersManager.getInstance().init();
        
Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (working copy)
@@ -21,6 +21,7 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.handler.ChatHandler;
 import net.sf.l2j.gameserver.handler.IChatHandler;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -171,6 +172,10 @@
            return;
        }
        
+       checkRandomFight(_text,activeChar);
+       if(_text.equalsIgnoreCase("?register") || _text.equalsIgnoreCase("?unregister"))
+           return;
+     
        if (_type == PETITION_PLAYER && activeChar.isGM())
            _type = PETITION_GM;
        
@@ -214,6 +219,45 @@
        return false;
    }
    
+   void checkRandomFight(String text,L2PcInstance player)
+   {
+       if(text.equalsIgnoreCase("?register"))
+       {
+           if(RandomFight.players.contains(player))
+           {
+               player.sendMessage("You have already registed to the event.");
+               return;
+           }
+           if(RandomFight.state == RandomFight.State.INACTIVE)
+               return;
+           if(RandomFight.state != RandomFight.State.REGISTER)
+           {
+               player.sendMessage("Event has already started.");
+               return;
+           }
+           RandomFight.players.add(player);
+           player.sendMessage("You registed to the event!!");
+           return;
+       }
+       if(text.equalsIgnoreCase("?unregister"))
+       {
+           if(!RandomFight.players.contains(player))
+           {
+               player.sendMessage("You haven't registed to the event.");
+               return;
+           }
+           if(RandomFight.state == RandomFight.State.INACTIVE)
+               return;
+           if(RandomFight.state != RandomFight.State.REGISTER)
+           {
+               player.sendMessage("Event has already started.");
+               return;
+           }
+           RandomFight.players.remove(player);
+           player.sendMessage("You unregisted from the  event!!");
+       }
+   }

    @Override
    protected boolean triggersOnActionRequest()
    {
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -37,6 +37,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.GameTimeController;
 import net.sf.l2j.gameserver.GeoData;
 import net.sf.l2j.gameserver.ItemsAutoDestroy;
@@ -103,6 +104,7 @@
 import net.sf.l2j.gameserver.model.PartyMatchRoom;
 import net.sf.l2j.gameserver.model.PartyMatchRoomList;
 import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.ShortCuts;
 import net.sf.l2j.gameserver.model.ShotType;
 import net.sf.l2j.gameserver.model.TradeList;
@@ -4077,6 +4079,19 @@
        {
            L2PcInstance pk = killer.getActingPlayer();
            
+           if(RandomFight.state == RandomFight.State.FIGHT)
+           {
+               if(RandomFight.players.contains(this) && RandomFight.players.contains(pk))
+               {
+                   pk.sendMessage("You are the winner!!!");
+                   Announcements.announceToAll("Random Fight Results:"+pk.getName()+" is the winner.");
+                   Announcements.announceToAll("Event Ended.");
+                   pk.addItem("",Config.RANDOM_FIGHT_REWARD_ID, Config.RANDOM_FIGHT_REWARD_COUNT, null, true);
+                   RandomFight.revert();
+                   RandomFight.clean();
+               }
+           }
+         
            // Clear resurrect xp calculation
            setExpBeforeDeath(0);
            
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 1)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -383,6 +383,11 @@
    public static boolean ALT_GAME_DELEVEL;
    public static int DEATH_PENALTY_CHANCE;
    
+   public static boolean ALLOW_RANDOM_FIGHT;
+   public static int EVERY_MINUTES;
+   public static int RANDOM_FIGHT_REWARD_ID;
+   public static int RANDOM_FIGHT_REWARD_COUNT;

    /** Inventory & WH */
    public static int INVENTORY_MAXIMUM_NO_DWARF;
    public static int INVENTORY_MAXIMUM_DWARF;
@@ -987,6 +992,12 @@
            ALT_GAME_DELEVEL = players.getProperty("Delevel", true);
            DEATH_PENALTY_CHANCE = players.getProperty("DeathPenaltyChance", 20);
            
+           ALLOW_RANDOM_FIGHT = players.getProperty("AllowRandomFight",true);
+           EVERY_MINUTES = players.getProperty("EveryMinutes",3);
+           RANDOM_FIGHT_REWARD_ID = players.getProperty("RewardId" , 8762);
+           RANDOM_FIGHT_REWARD_COUNT = players.getProperty("RewardCount" , 5);
+         
+         
            INVENTORY_MAXIMUM_NO_DWARF = players.getProperty("MaximumSlotsForNoDwarf", 80);
            INVENTORY_MAXIMUM_DWARF = players.getProperty("MaximumSlotsForDwarf", 100);
            INVENTORY_MAXIMUM_QUEST_ITEMS = players.getProperty("MaximumSlotsForQuestItems", 100);
Index: java/net/sf/l2j/gameserver/model/RandomFight.java
===================================================================
--- java/net/sf/l2j/gameserver/model/RandomFight.java   (revision 0)
+++ java/net/sf/l2j/gameserver/model/RandomFight.java   (revision 0)
@@ -0,0 +1,273 @@
+/*
+ * 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.model;
+
+import java.util.Vector;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * @author lioy
+ *
+ */
+public class RandomFight
+{
+    public static enum State{INACTIVE,REGISTER,LOADING,FIGHT}
+    public static State state = State.INACTIVE;
+  
+   public static Vector<L2PcInstance> players = new Vector<>();

+   protected void openRegistrations()
+   {
+       state = State.REGISTER;
+       Broadcast.announceToOnlinePlayers("Random Fight Event will start in 1 minute.");
+       Broadcast.announceToOnlinePlayers("To register press ?register");
+       ThreadPoolManager.getInstance().scheduleGeneral(new checkRegist(), 60000 );
+   }
+  
+   protected void checkRegistrations()
+    {
+       state=State.LOADING;
+     
+       if(players.isEmpty() || players.size() < 2)
+       {
+           Broadcast.announceToOnlinePlayers("Random Fight Event will not start cause of no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+       Broadcast.announceToOnlinePlayers("Amount of players Registed: "+players.size());
+       Broadcast.announceToOnlinePlayers("2 Random players will be choosen in 30 seconds!");
+       ThreadPoolManager.getInstance().scheduleGeneral(new pickPlayers(), 30000 );
+    }
+  
+
+   protected void pickPlayers()
+    {
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("Random Fight Event aborted because no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+     
+       for(L2PcInstance p : players)
+           if(p.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(p))
+           {
+               players.remove(p);
+               p.sendMessage("You automatically left from event because of your olympiad obligations.");
+           }
+
+     
+       int rnd1=Rnd.get(players.size());
+       int rnd2=Rnd.get(players.size());
+     
+       while(rnd2==rnd1)
+           rnd2=Rnd.get(players.size());
+     
+       for(L2PcInstance player : players)
+       {
+           if(player != players.get(rnd1) && player != players.get(rnd2))
+               players.remove(player);
+       }
+     
+       Broadcast.announceToOnlinePlayers("Players selected: "+players.firstElement().getName()+" || "+players.lastElement().getName());
+       Broadcast.announceToOnlinePlayers("Players will be teleported in 15 seconds");
+       ThreadPoolManager.getInstance().scheduleGeneral(new teleportPlayers(), 15000);
+    }
+  
+
+   protected void teleport()
+    {
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("Random Fight Event aborted because no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+       Broadcast.announceToOnlinePlayers("Players teleported!");
+     
+       players.firstElement().teleToLocation(113474,15552,3968,0);
+       players.lastElement().teleToLocation(112990,15489,3968,0);
+       players.firstElement().setTeam(1);
+       players.lastElement().setTeam(2);
+     
+       //para,etc
+     
+       players.firstElement().sendMessage("Fight will begin in 15 seconds!");
+       players.lastElement().sendMessage("Fight will begin in 15 seconds!");
+     
+       ThreadPoolManager.getInstance().scheduleGeneral(new fight(), 15000);
+    }

+   protected void startFight()
+    {
+     
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("One of the players isn't online, event aborted we are sorry!");
+           clean();
+           return;
+       }
+     
+       state = State.FIGHT;
+       Broadcast.announceToOnlinePlayers("FIGHT STARTED!");
+       players.firstElement().sendMessage("Start Fight!!");
+       players.lastElement().sendMessage("Start Fight!");
+       ThreadPoolManager.getInstance().scheduleGeneral(new checkLast(), 120000 );
+    }
+  
+    protected void lastCheck()
+    {
+       if(state == State.FIGHT)
+       {
+           if(players.isEmpty() || players.size() < 2)
+           {
+               revert();
+               clean();
+               return;
+           }
+         
+           int alive=0;
+           for(L2PcInstance player : players)
+           {
+               if(!player.isDead())
+                   alive++;
+           }
+         
+           if(alive==2)
+           {
+               Broadcast.announceToOnlinePlayers("Random Fight ended tie!");
+               clean();
+               revert();
+           }
+       }
+    }

+   public static void revert()
+   {
+       if(!players.isEmpty())
+       for(L2PcInstance p : players)
+       {
+           if(p == null)
+               continue;
+         
+           if(p.isDead())
+               p.doRevive();
+         
+           p.setCurrentHp(p.getMaxHp());
+           p.setCurrentCp(p.getMaxCp());
+           p.setCurrentMp(p.getMaxMp());
+           p.broadcastUserInfo();
+           p.teleToLocation(82698,148638,-3473,0);
+     
+       }
+   }

+   public static void clean()
+   {
+     
+       if(state == State.FIGHT)
+           for(L2PcInstance p : players)
+               p.setTeam(0);
+
+     
+       players.clear();
+       state = State.INACTIVE;
+     
+   }

+   protected RandomFight()
+   {
+       ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Event(), 60000 * Config.EVERY_MINUTES , 60000 * Config.EVERY_MINUTES);
+   }

+   public static RandomFight getInstance()
+   {
+       return SingletonHolder._instance;
+   }

+   private static class SingletonHolder
+   {
+       protected static final RandomFight _instance = new RandomFight();
+   }

+   protected class Event implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           if(state == State.INACTIVE)
+               openRegistrations();
+       }
+     
+   }

+   protected class checkRegist implements Runnable
+   {
+
+       @Override
+       public void run()
+       {
+               checkRegistrations();
+       }
+     
+   }

+   protected class pickPlayers implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           pickPlayers();
+       }
+     
+   }

+   protected class teleportPlayers implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           teleport();
+       }
+     
+   }

+   protected class fight implements Runnable
+   {
+
+       @Override
+       public void run()
+       {
+           startFight();
+       }
+     
+   }

+   protected class checkLast implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           lastCheck();
+       }
+     
+   }
+}
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (working copy)
@@ -17,11 +17,13 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.L2GameClient;
 import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
 import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.CharSelectInfo;
 import net.sf.l2j.gameserver.network.serverpackets.RestartResponse;
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
@@ -66,6 +68,13 @@
            return;
        }
        
+       if(RandomFight.players.contains(player))
+       {
+           player.sendMessage("You can't restart when you are in random fight event.");
+           player.sendPacket(ActionFailed.STATIC_PACKET);
+           return;
+       }
+     
        if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !player.isGM())
        {
            if (Config.DEBUG)

Default delay: 3 minutes(it was for test)

Configuarable(including reward id,count,allow or no the event and delay)

?register to register

?unregister to unregister

Tested(no errors)

Creditos: discorder25 y practice.
#37
L2 | Eventos / Evento Survey System (Votacion...
Último mensaje por Swarlog - Jun 28, 2025, 11:45 PM

Se trata de un sistema de votaciones para dentro del servidor, muy util y practico ^^

### Eclipse Workspace Patch 1.0
#P L2JHellasD
Index: data/xml/adminCommands.xml
===================================================================
--- data/xml/adminCommands.xml    (revision 395)
+++ data/xml/adminCommands.xml    (working copy)
@@ -531,4 +531,22 @@
    <admin command="admin_premium_add3" accessLevel="7" />
    <admin command="admin_premium_add4" accessLevel="7" />
    <admin command="admin_premium_add5" accessLevel="7" />
+   
+    <!-- ADMIN SURVEY -->
+    <admin command="admin_survey_start" accessLevel="7" />
+    <admin command="admin_survey_results" accessLevel="7" />
+    <admin command="admin_opmore" accessLevel="7" />
+    <admin command="admin_opless" accessLevel="7" />
+    <admin command="admin_survey_run1" accessLevel="7" />
+    <admin command="admin_survey_run2" accessLevel="7" />
+    <admin command="admin_survey_run3" accessLevel="7" />
+    <admin command="admin_survey_run4" accessLevel="7" />
+    <admin command="admin_survey_qset" accessLevel="7" />
+    <admin command="admin_survey_ans1set" accessLevel="7" />
+    <admin command="admin_survey_ans2set" accessLevel="7" />
+    <admin command="admin_survey_ans3set" accessLevel="7" />
+    <admin command="admin_survey_ans4set" accessLevel="7" />
+    <admin command="admin_survey_ans5set" accessLevel="7" />
+    <admin command="admin_survey_end" accessLevel="7" />
+    <admin command="admin_survey_results" accessLevel="7" />
</list>
\ No newline at end of file
#P L2JHellasC
Index: java/com/l2jhellas/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- java/com/l2jhellas/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 395)
+++ java/com/l2jhellas/gameserver/network/clientpackets/RequestBypassToServer.java    (working copy)
@@ -28,6 +28,7 @@
import com.l2jhellas.gameserver.datatables.xml.AdminData;
import com.l2jhellas.gameserver.handler.AdminCommandHandler;
import com.l2jhellas.gameserver.handler.IAdminCommandHandler;
+import com.l2jhellas.gameserver.handler.admincommandhandlers.AdminSurvey;
import com.l2jhellas.gameserver.model.L2CharPosition;
import com.l2jhellas.gameserver.model.L2Object;
import com.l2jhellas.gameserver.model.L2World;
@@ -304,6 +305,89 @@
                    activeChar.sendMessage("Something went wrong.");
                }
            }
+            else if (_command.equals("survey_vote1"))
+            {
+                if(AdminSurvey.running == false)
+                {
+                    activeChar.sendMessage("There is no survey running now");
+                    return;
+                }
+               
+                if(activeChar.hasVotedSurvey())
+                {
+                    activeChar.sendMessage("You already voted for that survey.");
+                    return;
+                }
+               
+                AdminSurvey.ans1_vote_count++;
+                activeChar.setHasVotedSurvey(true);
+                activeChar.sendMessage("You voted : " + AdminSurvey.ans1 + ". Thanks for voting");
+            }
+            else if (_command.equals("survey_vote2"))
+            {
+                if(AdminSurvey.running == false)
+                {
+                    activeChar.sendMessage("There is no survey running now");
+                    return;
+                }
+                if(activeChar.hasVotedSurvey())
+                {
+                    activeChar.sendMessage("You already voted for that survey.");
+                    return;
+                }
+               
+                AdminSurvey.ans2_vote_count++;
+                activeChar.setHasVotedSurvey(true);
+                activeChar.sendMessage("You voted : " + AdminSurvey.ans2 + ". Thanks for voting");
+            }
+            else if (_command.equals("survey_vote3"))
+            {
+                if(AdminSurvey.running == false)
+                {
+                    activeChar.sendMessage("There is no survey running now");
+                    return;
+                }
+                if(activeChar.hasVotedSurvey())
+                {
+                    activeChar.sendMessage("You already voted for that survey.");
+                    return;
+                }
+                AdminSurvey.ans3_vote_count++;
+                activeChar.setHasVotedSurvey(true);
+                activeChar.sendMessage("You voted : " + AdminSurvey.ans3 + ". Thanks for voting");
+            }
+            else if (_command.equals("survey_vote4"))
+            {
+                if(AdminSurvey.running == false)
+                {
+                    activeChar.sendMessage("There is no survey running now");
+                    return;
+                }
+                if(activeChar.hasVotedSurvey())
+                {
+                    activeChar.sendMessage("You already voted for that survey.");
+                    return;
+                }
+                AdminSurvey.ans4_vote_count++;
+                activeChar.setHasVotedSurvey(true);
+                activeChar.sendMessage("You voted : " + AdminSurvey.ans4 + ". Thanks for voting");
+            }
+            else if (_command.equals("survey_vote5"))
+            {
+                if(AdminSurvey.running == false)
+                {
+                    activeChar.sendMessage("There is no survey running now");
+                    return;
+                }
+                if(activeChar.hasVotedSurvey())
+                {
+                    activeChar.sendMessage("You already voted for that survey.");
+                    return;
+                }
+                AdminSurvey.ans5_vote_count++;
+                activeChar.setHasVotedSurvey(true);
+                activeChar.sendMessage("You voted : " + AdminSurvey.ans5 + ". Thanks for voting");
+            }
            else if (_command.startsWith("npc_"))
            {
                if (!activeChar.validateBypass(_command))
Index: java/com/l2jhellas/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- java/com/l2jhellas/gameserver/handler/VoicedCommandHandler.java    (revision 395)
+++ java/com/l2jhellas/gameserver/handler/VoicedCommandHandler.java    (working copy)
@@ -30,6 +30,7 @@
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.Premium;
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.QuizCmd;
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.ServerRestartVote;
+import com.l2jhellas.gameserver.handler.voicedcommandhandlers.Survey;
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.VipTeleport;
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.VoiceInfo;
import com.l2jhellas.gameserver.handler.voicedcommandhandlers.Wedding;
@@ -90,6 +91,7 @@
            registerVoicedCommandHandler(new ZodiacRegistration());
        registerVoicedCommandHandler(new Premium());
        registerVoicedCommandHandler(new QuizCmd());
+        registerVoicedCommandHandler(new Survey());

        _log.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + size() + " Handlers in total.");
    }
Index: java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminSurvey.java
===================================================================
--- java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminSurvey.java    (revision 0)
+++ java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminSurvey.java    (working copy)
@@ -0,0 +1,769 @@
+/*
+ * 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.l2jhellas.gameserver.handler.admincommandhandlers;
+
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+import javolution.text.TextBuilder;
+
+import com.l2jhellas.gameserver.handler.IAdminCommandHandler;
+import com.l2jhellas.gameserver.model.L2World;
+import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jhellas.gameserver.network.clientpackets.Say2;
+import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
+import com.l2jhellas.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jhellas.util.Broadcast;
+
+/**
+ *
+ * @author Elfocrash
+ *
+ */
+public class AdminSurvey implements IAdminCommandHandler
+{
+    public static int options = 2;
+    public static int mode = 0;
+    public static boolean running = false;
+    private static boolean qset = false;
+    private static boolean ans1set = false;
+    private static boolean ans2set = false;
+    private static boolean ans3set = false;
+    private static boolean ans4set = false;
+    private static boolean ans5set = false;
+    public static String quest = "";
+    public static String ans1 = "";
+    public static String ans2 = "";
+    public static String ans3 = "";
+    public static String ans4 = "";
+    public static String ans5 = "";
+    public static int ans1_vote_count = 0;
+    public static int ans2_vote_count = 0;
+    public static int ans3_vote_count = 0;
+    public static int ans4_vote_count = 0;
+    public static int ans5_vote_count = 0;
+   
+    private static final String[] ADMIN_COMMANDS =
+    {
+        "admin_survey_start",
+        "admin_survey_results",
+        "admin_opmore",
+        "admin_opless",
+        "admin_survey_run1",
+        "admin_survey_run2",
+        "admin_survey_run3",
+        "admin_survey_run4",
+        "admin_survey_qset",
+        "admin_survey_ans1set",
+        "admin_survey_ans2set",
+        "admin_survey_ans3set",
+        "admin_survey_ans4set",
+        "admin_survey_ans5set",
+        "admin_survey_end",
+        "admin_survey_results"
+    };
+   
+    @Override
+    public boolean useAdminCommand(String command, L2PcInstance activeChar)
+    {
+        if (command.equals("admin_survey_start"))
+            startHtml(activeChar);
+       
+        if (command.equals("admin_survey_results"))
+            resultsHtml(activeChar);
+       
+       
+        if (command.equals("admin_survey_end"))
+        {
+            int moreVotes = ans1_vote_count;
+            if (moreVotes < ans2_vote_count) {moreVotes = ans2_vote_count;}
+            if (moreVotes < ans3_vote_count) {moreVotes = ans3_vote_count;}
+            if (moreVotes < ans4_vote_count) {moreVotes = ans4_vote_count;}
+            if (moreVotes < ans5_vote_count) {moreVotes = ans5_vote_count;}
+           
+            Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The survey session is over.Thanks everyone for voting."));
+            if( moreVotes == ans1_vote_count)
+                Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans1 +" won the survey with " + ans1_vote_count +" votes on the question : "+ quest+"."));
+            if( moreVotes == ans2_vote_count)
+                Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans2 +" won the survey with " + ans2_vote_count +" votes on the question : "+ quest+"."));
+            if( moreVotes == ans3_vote_count)
+                Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans3 +" won the survey with " + ans3_vote_count +" votes on the question : "+ quest+"."));
+            if( moreVotes == ans4_vote_count)
+                Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans4 +" won the survey with " + ans4_vote_count +" votes on the question : "+ quest+"."));
+            if( moreVotes == ans5_vote_count)
+                Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans5 +" won the survey with " + ans5_vote_count +" votes on the question : "+ quest+"."));
+           
+            running = false;
+            resultsHtml(activeChar);
+            quest = "";
+            ans1 = "";
+            ans2 = "";
+            ans3 = "";
+            ans4 = "";
+            ans5 = "";
+            mode = 0;
+            ans1_vote_count = 0;
+            ans2_vote_count = 0;
+            ans3_vote_count = 0;
+            ans4_vote_count = 0;
+            ans5_vote_count = 0;
+            setQset(false);
+            setAns1set(false);
+            setAns2set(false);
+            setAns3set(false);
+            setAns4set(false);
+            setAns5set(false);
+           
+            Collection<L2PcInstance> pls = L2World.getAllPlayers();
+            for (L2PcInstance onlinePlayers : pls)
+            {
+                onlinePlayers.setHasVotedSurvey(false);
+            }
+           
+            Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The survey session is over.Thanks everyone for voting."));
+        }
+       
+        if(command.equals("admin_opmore"))
+            if(options <= 4)
+            {
+                options++;
+                startHtml(activeChar);
+            }
+            else
+            {
+                return false;
+            }
+       
+        if(command.equals("admin_opless"))
+            if(options >= 3)
+            {
+                options--;
+                startHtml(activeChar);
+            }
+            else
+            {
+                return false;
+            }
+       
+        if(command.startsWith("admin_survey_qset"))
+        {
+            if(isQset())
+            {
+                quest = "";
+                setQset(false);
+                startHtml(activeChar);
+            }
+            else if(!isQset())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                quest = quest + s.nextToken() + " ";
+                setQset(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+       
+        if(command.startsWith("admin_survey_ans1set"))
+        {
+            if(isAns1set())
+            {
+                ans1 = "";
+                setAns1set(false);
+                startHtml(activeChar);
+            }
+            else if(!isAns1set())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                ans1 = ans1 + s.nextToken() + " ";
+                setAns1set(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+       
+        if(command.startsWith("admin_survey_ans2set"))
+        {
+            if(isAns2set())
+            {
+                ans2 = "";
+                setAns2set(false);
+                startHtml(activeChar);
+            }
+            else if(!isAns2set())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                ans2 = ans2 + s.nextToken() + " ";
+                setAns2set(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+       
+        if(command.startsWith("admin_survey_ans3set"))
+        {
+            if(isAns3set())
+            {
+                ans3 = "";
+                setAns3set(false);
+                startHtml(activeChar);
+            }
+            else if(!isAns3set())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                ans3 = ans3 + s.nextToken() + " ";
+                setAns3set(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+        if(command.startsWith("admin_survey_ans4set"))
+        {
+            if(isAns4set())
+            {
+                ans4 = "";
+                setAns4set(false);
+                startHtml(activeChar);
+            }
+            else if(!isAns4set())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                ans4 = ans4 + s.nextToken() + " ";
+                setAns4set(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+       
+        if(command.startsWith("admin_survey_ans5set"))
+        {
+            if(isAns5set())
+            {
+                ans5 = "";
+                setAns5set(false);
+                startHtml(activeChar);
+            }
+            else if(!isAns5set())
+            {
+            StringTokenizer s = new StringTokenizer(command);
+            s.nextToken();
+           
+            try{
+               
+                while(s.hasMoreTokens())
+                ans5 = ans5 + s.nextToken() + " ";
+                setAns5set(true);
+                startHtml(activeChar);
+           
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        }
+       
+       
+       
+        if(command.startsWith("admin_survey_run1"))
+        {
+            if(running == true)
+            {
+                activeChar.sendMessage("A survey is already in progres.");
+                return false;
+            }
+            if(!isQset() || !isAns1set() || !isAns2set())
+            {
+                activeChar.sendMessage("You have to set all the fields before you start the survey");
+                return false;
+            }
+                mode = 1;
+                running = true;
+         Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main question "+ quest+". Use .survey to vote."));
+           
+           
+        }
+       
+        if(command.startsWith("admin_survey_run2"))
+        {
+            if(running == true)
+            {
+                activeChar.sendMessage("A survey is already in progress");
+                return false;
+           
+            }
+            if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set())
+            {
+                activeChar.sendMessage("You have to set all the fields before you start the survey");
+                return false;
+            }
+                mode = 2;
+                running = true;
+         Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main question "+ quest+". Use .survey to vote."));
+           
+           
+        }
+       
+        if(command.startsWith("admin_survey_run3"))
+        {
+            if(running == true)
+            {
+                activeChar.sendMessage("A survey is already in progress");
+                return false;
+           
+            }
+           
+            if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set() || !isAns4set())
+            {
+                activeChar.sendMessage("You have to set all the fields before you start the survey");
+                return false;
+            }
+                mode = 3;
+                running = true;
+         Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main question "+ quest+". Use .survey to vote."));
+           
+           
+        }
+       
+        if(command.startsWith("admin_survey_run4"))
+        {
+            if(running == true)
+            {
+                activeChar.sendMessage("A survey is already in progress");
+                return false;
+           
+            }
+           
+            if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set() || !isAns4set() || !isAns5set())
+            {
+                activeChar.sendMessage("You have to set all the fields before you start the survey");
+                return false;
+            }
+                mode = 4;
+                running = true;
+         Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main question "+ quest+". Use .survey to vote."));
+           
+           
+        }
+       
+            return true;
+    }
+   
+    @Override
+    public String[] getAdminCommandList()
+    {
+        return ADMIN_COMMANDS;
+    }
+   
+    private static void startHtml(L2PcInstance activeChar)
+    {
+        NpcHtmlMessage nhm = new NpcHtmlMessage(5);
+        TextBuilder tb = new TextBuilder("");
+       
+        tb.append("<html><head><title>Start Survey form</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\"><font color=\"FF6600\">Start a Survey</font>");
+        tb.append("<br1><font color=\"FF6600\">"+activeChar.getName()+"</font>, use this form in order to start a survey.<br1></td>");
+        tb.append("</tr>");
+        tb.append("</table>");
+        tb.append("</center>");
+        tb.append("<center>");
+        if(!isQset())
+        {
+            tb.append("<font color=\"FF6600\">Type in the main question of the survey.</font><br>");
+            tb.append("<table border=\"0\" width=\"250\" height=\"16\" bgcolor=\"000000\">");
+            tb.append("<tr><td><multiedit var=\"quest\" width=170 height=20></td><td><a action=\"bypass -h admin_survey_qset $quest\">Save</a></td></tr></table>");
+        }
+        if(isQset())
+        {
+            tb.append("<font color=\"FF6600\">The question set is:<br>");
+            tb.append("<table border=\"0\" width=\"250\" height=\"16\" bgcolor=\"000000\">");
+            tb.append("<tr><td><font color=\"FF0000\">" + quest+"</font></td><td><a action=\"bypass -h admin_survey_qset\">Edit</a></td></tr></table>");
+        }
+        tb.append("<br><font color=\"FF6600\">Possible answers.");
+        tb.append("<table border=\"0\" width=\"70\" height=\"16\" bgcolor=\"000000\">");
+        tb.append("<tr>");
+        tb.append("<td width=\"52\">More</td>");
+        tb.append("<td width=\"16\"><button action=\"bypass -h admin_opmore\" width=16 height=16 back=\"L2UI_CH3.upbutton_down\" fore=\"L2UI_CH3.upbutton\"></td>");
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td width=\"52\">Less</td>");
+        tb.append("<td width=\"16\"><button action=\"bypass -h admin_opless\" width=16 height=16 back=\"L2UI_CH3.downbutton_down\" fore=\"L2UI_CH3.downbutton_down\"></td>");
+        tb.append("</tr>");
+        tb.append("</table>");
+        tb.append("<table width=\"300\" height=\"20\">");
+        tb.append("<tr>");
+        tb.append("<td align=\"center\" width=\"40\">Answer 1:</td>");
+        if(!isAns1set())
+        {
+            tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans1\" width=150 height=16></td>");
+            tb.append("<td><a action=\"bypass -h admin_survey_ans1set $ans1\">Save</a></td>");
+        }
+        else if(isAns1set())
+        {
+            tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans1 + "</font></td>");
+            tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans1set\">Edit</a></td>");
+        }
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td align=\"center\" width=\"40\">Answer 2:</td>");
+        if(!isAns2set())
+        {
+            tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans2\" width=150 height=16></td>");
+            tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans2set $ans2\">Save</a></td>");
+        }
+        else if(isAns2set())
+        {
+            tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans2 + "</font></td>");
+            tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans2set\">Edit</a></td>");
+        }
+        tb.append("</tr>");
+        if(options == 3)
+        {
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>");
+            if(!isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>");
+            }
+            else if(isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+        }
+        if(options == 4)
+        {
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>");
+            if(!isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>");
+            }
+            else if(isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>");
+            if(!isAns4set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans4\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set $ans4\">Save</a></td>");
+            }
+            else if(isAns4set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans4 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+        }
+        if(options == 5)
+        {
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>");
+            if(!isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>");
+            }
+            else if(isAns3set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>");
+            if(!isAns4set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans4\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set $ans4\">Save</a></td>");
+            }
+            else if(isAns4set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans4 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 5:</td>");
+            if(!isAns5set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans5\" width=150 height=16></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans5set $ans5\">Save</a></td>");
+            }
+            else if(isAns5set())
+            {
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans5 + "</font></td>");
+                tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans5set\">Edit</a></td>");
+            }
+            tb.append("</tr>");
+        }
+        tb.append("</table><br>");
+        if(options == 2)
+        tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run1\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">");
+        if(options == 3)
+        tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run2\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">");
+        if(options == 4)
+        tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run3\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">");
+        if(options == 5)
+        tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run4\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">");
+        tb.append("</center>");
+        tb.append("</body></html>");
+       
+        nhm.setHtml(tb.toString());
+        activeChar.sendPacket(nhm);
+    }
+   
+    private static void resultsHtml(L2PcInstance activeChar)
+    {
+        NpcHtmlMessage nhm = new NpcHtmlMessage(5);
+        TextBuilder tb = new TextBuilder("");
+       
+        tb.append("<html><head><title>Survey form</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\"><font color=\"FF6600\">Survey</font>");
+        tb.append("<br1><font color=\"FF6600\">"+activeChar.getName()+"</font>, here are the survey's results.<br1></td>");
+        tb.append("</tr>");
+        tb.append("</table>");
+        tb.append("</center>");
+        tb.append("<center>");
+        tb.append("<font color=\"FF6600\">The question set is:<br>");
+        tb.append("<font color=\"FF0000\">" + AdminSurvey.quest+"</font></center>");
+        tb.append("<br><font color=\"FF6600\">Choose an answer.");
+        tb.append("<table width=\"300\" height=\"20\">");
+        tb.append("<tr>");
+        tb.append("<td align=\"center\" width=\"40\">Answer 1:</td>");
+        tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans1 + "</font></td>");
+        tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans1_vote_count+ "</font></td>");
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td align=\"center\" width=\"40\">Answer 2:</td>");
+        tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans2 + "</font></td>");
+        tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans2_vote_count+ "</font></td>");
+        tb.append("</tr>");
+        if(mode == 2)
+        {
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>");
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>");
+                tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans3_vote_count+ "</font></td>");
+           
+            tb.append("</tr>");
+        }
+        if(mode == 3)
+        {
+            tb.append("<tr>");
+            tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>");
+                tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>");
+                tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans3_vote_count+ "</font></td>");
+           
+            tb.append("</tr&
#38
L2 | Eventos / Fortress Siege
Último mensaje por Swarlog - Jun 28, 2025, 11:45 PM
Se trata de un evento que he encontrado, esta algo abandonado pero me parecio buena idea revivirlo para adaptarlo a vuestras crónicas y podais disfrutar de el en vuestros servidores.

El evento consiste en la creación de dos bandos, uno será el defensor y otro el atacante. Al comenzar el evento los participantes son teletransportados a una fortaleza elegida aleatoriamente y comienza el asedio.

Al tomar un bando la fortaleza, ahora ellos son los defensores. Por lo que el evento no tiene fin una vez que comience, hasta el tiempo que queráis.
#39
L2 | Eventos / Evento Hitman Full Files
Último mensaje por Swarlog - Jun 28, 2025, 11:44 PM
Pues se trata de un evento muy utilizado en servidores PvP. Funciona desde un NPC, cuando hablas con el tienes la oportunidad de poner el nombre de un jugador y una recompensa en la lista negra. El proposito de este evento es el de crear caza recompensas dentro del servidor, es decir, quien mate al jugador que indicaste, ganara/obtendra la recompensa que tambien indicaste. Es una buena forma de tener el servidor siempre en actividad.

La descarga contiene todos los datos requeridos para este evento; instancia, sql, path, etc.. Difrutenlo!
#40
L2 | Eventos / Evento School Days
Último mensaje por Swarlog - Jun 28, 2025, 11:44 PM
SchoolDays.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.SchoolDays;

import com.l2jserver.FunEvents;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.base.Race;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.util.Rnd;

/**
 * @Fixed by L2Ps Team
 */
public class SchoolDays extends Quest
{
    private static final String qn = "SchoolDays";
    private static final int SCHOOL_DAYS_NPC = 13182;
    private static final int[] EventMonsters =
    {
        7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,
        7010,7011,7012,7013,7014,7015,7016,7017,7018,7019,
        7020,7021,7022,7023
    };
    private static final int[] BOOKS_HUMAN =
    {
        1372,1397,1401
    };
    private static final int[] BOOKS_ELF =
    {
        1370,1380,1402
    };
    private static final int[] BOOKS_DARK_ELF =
    {
        1371,1391,1408
    };
    private static final int[] BOOKS_ORC =
    {
        1518,1519,1520
    };
    private static final int[] BOOKS_DWARF =
    {
        3038,3940,4915
    };
    private static final int[] BOOKS_KAMAEL =
    {
        10025,10026,10027
    };
   
    /**
     * On First Talk Script
     * @param npc
     * @param player
     * @return
     */
    @Override
    public final String onFirstTalk(L2Npc npc, L2PcInstance player)
    {
        QuestState st = player.getQuestState(qn);
        if (st == null)
        {
            st = newQuestState(player);
            st.setState(State.STARTED);
        }
        String htmltext = "";
        if (FunEvents.SD_STARTED)
        {
            htmltext = "welcome.htm";
        }
        else
        {
            htmltext = FunEvents.EVENT_DISABLED;
        }
        return htmltext;
    }

    /**
     * On Advanced Event Script
     */
    @Override
    public final String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
    {
        QuestState st = player.getQuestState(qn);
        if (st == null)
        {
            st = newQuestState(player);   
        }
        String htmltext = "";
       
        if (event.equalsIgnoreCase("getreward"))
        {
            htmltext = "reward.htm";
        }
        if (event.equalsIgnoreCase("info"))
        {
            htmltext = "info.htm";
        }
        if (event.equalsIgnoreCase("back"))
        {
            htmltext = "welcome.htm";
        }
           return htmltext;
    }   

    /**
     * On Kill Monster Script
     */
    @Override
    public final String onKill(L2Npc npc,L2PcInstance player, boolean isPet)
    {
        QuestState st = player.getQuestState(getName());
        if (st == null)
        {
            st = newQuestState(player);   
        }
        int npcId = npc.getNpcId();
        if (FunEvents.SD_ACTIVE_DROP)
        {
            for(int ID : EventMonsters)
            {
                if (npcId == ID)
                {
                    if (player.getRace() == Race.Human)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_HUMAN[Rnd.get(BOOKS_HUMAN.length)],1);
                        }
                    }
                    else if (player.getRace() == Race.Elf)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_ELF[Rnd.get(BOOKS_ELF.length)],1);
                        }
                    }
                    else if (player.getRace() == Race.DarkElf)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_DARK_ELF[Rnd.get(BOOKS_DARK_ELF.length)],1);
                        }
                    }
                    else if (player.getRace() == Race.Orc)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_ORC[Rnd.get(BOOKS_ORC.length)],1);
                        }
                    }
                    else if (player.getRace() == Race.Dwarf)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_DWARF[Rnd.get(BOOKS_DWARF.length)],1);
                        }
                    }
                    else if (player.getRace() == Race.Kamael)
                    {
                        int random = Rnd.get(100);
                        if (random < 33)
                        {
                            st.giveItems(BOOKS_KAMAEL[Rnd.get(BOOKS_KAMAEL.length)],1);
                        }
                    }
                }
            }           
        }
        return super.onKill(npc, player, isPet);
    }   
   
    public SchoolDays(int questId, String name, String descr)
    {
        super(questId, name, descr);       
        addStartNpc(SCHOOL_DAYS_NPC);
        addFirstTalkId(SCHOOL_DAYS_NPC);
        addTalkId(SCHOOL_DAYS_NPC);
        for (int MONSTER: EventMonsters)
        {
            addKillId(MONSTER);
        }       
    }
   
    public static void main(String[] args)
    {
        new SchoolDays(-1,qn,"events");
        if (FunEvents.SD_STARTED)
            _log.info("Event System: School Day Event loaded ...");
    }
}

info.htm

<html><body>Library Merchant:<br>
I know that monsters in Mission Dungeon know where is that books.<br>
Go to mission dungeon and collect your race <font color=LEVEL>books </font> to learn skills.<br>
Then come back and i exchange books to <font color=LEVEL>shadow weapons, armors, enchant book or life stones</font>.
<br>
</body></html>

reward.htm

<html><body>Library Merchant:<br>
Now we can exchange:<br><br>
<a action="bypass -h npc_%objectId%_multisell 13182001">I have HUMAN books.</a><br1>
<a action="bypass -h npc_%objectId%_multisell 13182002">I have ELF books.</a><br1>
<a action="bypass -h npc_%objectId%_multisell 13182003">I have DARK ELF books.</a><br1>
<a action="bypass -h npc_%objectId%_multisell 13182004">I have ORC books.</a><br1>
<a action="bypass -h npc_%objectId%_multisell 13182005">I have DWARF books.</a><br1>
<a action="bypass -h npc_%objectId%_multisell 13182006">I have KAMAEL books.</a><br1>
</body></html>

welcome.htm

<html><body>Library Merchant: <br>
Great Library burned 2 years ago. Now we searching materials that not used more like: spellbooks, amulets or blueprints. That items long time ago is used to learn skills. I know that only <font color="LEVEL"> YOU</font> remember your skills, so please help me.<br1>
Go and search for skills books please.<br1>
<a action="bypass -h Quest SchoolDays getreward">I found books for my race ...</a><br>
<a action="bypass -h Quest SchoolDays info">About Library</a><br>
</body></html>