Autor Tema: [JFROZEN REV 1132] Error evento Last Man  (Leído 15 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Socialism

  • Grado D
  • *
  • Topic Author
  • Mensajes: 94
  • 00
  • Agradecimientos: 5
  • Cronica: : Interlude
  • Revision: Rev. 1132
  • S.O: Sin seleccionar / Not choosen
  • Serverpack : L2jfrozen
[JFROZEN REV 1132] Error evento Last Man
« en: Marzo 26, 2020, 10:35:13 pm »
gracias
Este post tiene 0 agradecimientos
  • Añade a tus favoritos
  • hola, como estan? espero que alguien me pueda ayudar.

    Agregue el evento Last Man a jfrozen rev 1132. El problema es que me esta dando error en 4 lineas de LastMan.java


    Código: [Seleccionar]
    if (p.getKarma() > 0) {

    -

    Código: [Seleccionar]
     p.sendPacket(new CreatureSay(1, Say2.PARTY, "LMS", "You cant not register because exceded the max players registered limit: "+ MaxPlayers + " players."));
    -

    Código: [Seleccionar]
    if (p.isInArenaEvent())
    -

    Código: [Seleccionar]
    if (EvtArenaManager.getInstance().isRegistered(p))


    Adjunto el codigo original. Espero que alguien me pueda ayudar :(

    CODIGO COMPLETO


    Código: [Seleccionar]
    Evento Last Man para Jfrozen

    Autor: AdvenTeam

    --- data/html/mods/LastMan/start.htm (revision 0)
    +++ data/html/mods/LastMan/start.htm (working copy)
    @@ -0,0 +1,27 @@
    ++<html>
    +<title>Last Man By Axcel</title>
    + <body>
    + <br>
    + <center><img src=L2UI.SquareWhite width=276 height=1></center>
    + <center>
    + <table width=256>
    + <tr>
    + <td><img src=L2UI.GM_Icon width=32 height=32></td>
    + <td width=192 align=center>
    + <font color="LEVEL">%servername%</font><br1>Bem Vindo!
    + </td>
    + <td><img src=L2UI.GM_Icon width=32 height=32></td>
    + </tr>
    + </table>
    + </center>
    + <br>
    + <center><img src=L2UI.SquareWhite width=276 height=1></center>
    + <br>
    + <center>
    + <font color=FF9900>Evento LastMan(Free for All).</font><br>
    + <button value="Registro" action="bypass -h npc_%objectId%_registro" width=100 height=15 back="sek.cbui94" fore="sek.cbui92"><br>
    + <button value="Remover" action="bypass -h npc_%objectId%_remove" width=100 height=15 back="sek.cbui94" fore="sek.cbui92"><br>
    + <font color=0099FF>O ultimo que sobreviver ira ganhar um premio !!.</font>
    + </center>
    + </body>
    +</html>
    \ No newline at end of file

    ### Eclipse Workspace Patch 1.0
    #P L2jAiren
    Index: config/head/other.properties
    ===================================================================
    --- config/head/other.properties (revision 986)
    +++ config/head/other.properties (working copy)
    @@ -4,6 +4,71 @@
    # Pack: l2jfrozen Site: www.l2jfrozen.com #
    #============================================================#

    +###########################################
    +# LastMan config #
    +# #########################################
    +# Enable / Disable Restart Auto
    +EnableLastManSystem = True
    +
    +# If EnableLastManSystem = True Describe hours of the day
    + Example: 22:00,23:00 (hh:mm,hh:mm...)
    +# NOTE: Separate ":" mm:hh and "," others restart time
    +LastManByTimeOfDay = 00:00,12:00
    +
    +# ID do npc que sera setado como L2LastManInstance
    +LastManNpcId = 93000
    +
    +# Id do item que o player vai ganhar
    +LastManItemId = 3470
    +
    +#Quantidade de itens que o player vai ganhar
    +LastManItemQuantia = 1
    +
    # Min / Max players can join in event
    LMSEventMinPlayers = 2
    LMSEventMaxPlayers = 5

    +# Loc da arena
    +#Coliseum default
    +#Loc x
    +LastManArenalocX = 149767
    +#Loc y
    +LastManArenalocY = 46731
    +#Loc z
    +LastManArenalocZ = -3415


    ### Eclipse Workspace Patch 1.0
    #P L2jAiren
    Index: head-src/com/l2jfrozen/gameserver/GameServer.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy)
    @@ -119,6 +119,7 @@
    import com.l2jfrozen.gameserver.model.entity.Announcements;
    import com.l2jfrozen.gameserver.model.entity.Hero;
    import com.l2jfrozen.gameserver.model.entity.MonsterRace;
    import com.l2jfrozen.gameserver.model.entity.event.manager.EventManager;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
    import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSigns;
    @@ -196,6 +197,7 @@

    Util.printSection("Team");

    +
    // Print L2jfrozen's Logo
    L2Frozen.info();

    @@ -559,9 +561,21 @@
    else
    _log.info("All events are Disabled.");

    if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
    OfflineTradeTable.restoreOfflineTraders();

    + Util.printSection("LastMan Manager");
    + if(Config.LASTMAN_BY_TIME_OF_DAY)
    + InitialEvents.getInstance().StartCalculationOfNextRestartTime();
    + else
    + _log.info("# Auto LastMan System is Disabled #");
    +
    + System.gc();
    +
    Util.printSection("Info");
    _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch());
    _log.info("Available CPUs: " + Util.getAvailableProcessors());

    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
    @@ -37,6 +37,7 @@
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.VersionCmd;
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
    +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.eventlhe;

    /**
    * This class ...
    @@ -65,6 +66,7 @@
    _datatable = new FastMap<String, IVoicedCommandHandler>();

    registerVoicedCommandHandler(new Voting());
    + registerVoicedCommandHandler(new eventlhe());

    if (Config.BANKING_SYSTEM_ENABLED)
    {
    @@ -85,7 +87,7 @@
    {
    registerVoicedCommandHandler(new DMCmd());
    }
    -
    +
    if (Config.L2JMOD_ALLOW_WEDDING)
    {
    registerVoicedCommandHandler(new Wedding());
    Index: head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java (working copy)
    @@ -0,0 +1,332 @@
    +package com.l2jfrozen.gameserver.model.entity.event;
    +
    +import javolution.util.FastList;
    +
    +import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
    +import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
    +import com.l2jfrozen.gameserver.datatables.sql.SpawnTable;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.Announcements;
    +import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
    +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    +import com.l2jfrozen.util.random.Rnd;
    + import com.l2jfrozen.gameserver.network.clientpackets.Say2;
    + import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
    +
    +/**
    + * This class ...
    + * @version $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $
    + */
    +public class LastMan implements Runnable
    +{
    + public static FastList<L2PcInstance> _players = new FastList<L2PcInstance>();
    + public static L2PcInstance winner = null;
    + public static L2PcInstance loser = null;
    + public static L2PcInstance player1 = null;
    + public static L2Spawn _bossSpawn;
    + public static String _eventName = "";
    + public static int _bossHeading = 0;
    + public static int MinPlayers = Config.LMS_MIN_PLAYERS;
    + public static int MaxPlayers = Config.LMS_MAX_PLAYERS;
    + public static L2PcInstance player2 = null;
    + public static boolean ativo = false;
    + public static boolean registro = false;
    + public static boolean teleporte = false;
    + public static boolean reward = false;
    + public static boolean lutando = false;
    +
    + @Override
    + public void run()
    + {
    + if (ativo == true)
    + {
    + return;
    + }
    + evento();
    +
    + }
    +
    + public static void evento()
    + {
    + registro = true;
    + ativo = true;
    + NpcSpawnLastMan();
    + Announcements.getInstance().gameAnnounceToAll("LastMan Started");
    + Announcements.getInstance().gameAnnounceToAll("5 minute(s) till registration close");
    + Announcements.getInstance().gameAnnounceToAll("Use to .joinlm or .leavelm or go to giran");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("4 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("3 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("2 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("1 minute(s) till registration close");
    + wait(1);
    + unspawnNpcLastMan();
    + if (_players.size() < Config.LMS_MIN_PLAYERS)
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.inLASTMAN = false;
    + }
    + Announcements.getInstance().gameAnnounceToAll("Not enough players for event, min: "+ MinPlayers +" players.");
    + Announcements.getInstance().gameAnnounceToAll("Last Man Event: Match Aborted!");
    + clear();
    + return;
    + }
    if (p.getKarma() > 0) {
    Announcements.getInstance().gameAnnounceToAll("You can not register, you have karma.");
    return;
    }

    + if (_players.size() >= Config.LMS_MAX_PLAYERS) {
    + p.sendPacket(new CreatureSay(1, Say2.PARTY, "LMS", "You cant not register because exceded the max players registered limit: "+ MaxPlayers + " players."));
    + return;
    + }
    + closeAdenColosseumDoors();
    + registro = false;
    + setUserData();
    + teleporte = true;
    + teleport(false);
    + prepare();
    + Announcements.getInstance().gameAnnounceToAll("You have 45 seconds to get prepared");
    + waitSecs(45);
    + start();
    + reward = true;
    + while (reward == true)
    + {
    + waitSecs(3);
    + endReward();
    + }
    + Announcements.getInstance().gameAnnounceToAll("The event LastMan ended the winner was " + player1 + " congratulations!");
    + waitSecs(1);
    + player1.inLASTMAN = false;
    + openAdenColosseumDoors();
    + clear();
    + }
    +
    + public static void teleport(boolean back)
    + {
    + if (!back)
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.restoreCP();
    + p.restoreHPMP();
    + p.teleToLocation(Config.LASTMAN_X_ARENA + Rnd.get(401) - 100, Config.LASTMAN_Y_ARENA + Rnd.get(301) - 100, Config.LASTMAN_Z_ARENA);
    + p.sendMessage("You have been moved to coliseum");
    + }
    + }
    + else
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.teleToLocation(82813, 148344, -3471);
    + p.sendMessage("You have been moved to giran");
    + }
    + }
    + }
    +
    + public static void register(L2PcInstance p)
    + {
    +
    + if (_players.contains(p))
    + {
    + p.sendMessage("You have already register");
    + return;
    + }
    + if (registro == false)
    + {
    + p.sendMessage("Can't register now");
    + return;
    + }
    + if (p.isInOlympiadMode())
    + {
    + p.sendMessage("You can't register while you have register for olympiad match");
    + return;
    + }
    + if (p.isInFunEvent())
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (p.isInArenaEvent())
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (EvtArenaManager.getInstance().isRegistered(p))
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (p.getKarma() > 0)
    + {
    + p.sendMessage("You can not register pk");
    + return;
    + }
    + _players.add(p);
    + p.sendMessage("You successfully registered for the event");
    + p.inLASTMAN = true;
    + }
    +
    + public static void unregister(L2PcInstance p)
    + {
    + if (!_players.contains(p))
    + {
    + p.sendMessage("You have already unregister");
    + return;
    + }
    +
    + if (registro == false)
    + {
    + p.sendMessage("You can't unregister while match is about to begin");
    + return;
    + }
    +
    + _players.remove(p);
    + p.sendMessage("Succesfully unregistered");
    + p.inLASTMAN = false;
    + }
    +
    + public static void prepare()
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.stopAllEffects();
    + p.setIsInvul(true);
    + p.sendMessage("You have 45 seconds to get prepared");
    + }
    + }
    +
    + public static void start()
    + {
    + lutando = true;
    +
    + for (L2PcInstance p : _players)
    + {
    + p.stopRooting(null);
    + p.setIsInvul(false);
    + p.sendMessage("Go go go,start fighting");
    + }
    + }
    +
    + private static void NpcSpawnLastMan()
    + {
    + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.LASTMAN_ID_NPC);// ID do mob
    + try
    + {
    + _bossSpawn = new L2Spawn(tmpl);
    +
    + _bossSpawn.setLocx(82640); // loc x
    + _bossSpawn.setLocy(148519); // loc y
    + _bossSpawn.setLocz(-3472); // loc z
    + _bossSpawn.setAmount(1);
    + _bossSpawn.setHeading(0);
    + _bossSpawn.setRespawnDelay(1);
    +
    + SpawnTable.getInstance().addNewSpawn(_bossSpawn, false);
    +
    + _bossSpawn.init();
    + _bossSpawn.getLastSpawn().setTitle(_eventName);
    + _bossSpawn.getLastSpawn().isAggressive();
    + _bossSpawn.getLastSpawn().decayMe();
    + _bossSpawn.getLastSpawn().spawnMe(_bossSpawn.getLastSpawn().getX(), _bossSpawn.getLastSpawn().getY(), _bossSpawn.getLastSpawn().getZ());
    + }
    + catch (Exception e)
    + {
    + System.out.println("Erro no evento");
    + }
    + }
    +
    + private static void unspawnNpcLastMan()
    + {
    + if (_bossSpawn == null || _bossSpawn.getLastSpawn() == null)
    + return;
    +
    + _bossSpawn.getLastSpawn().deleteMe();
    + _bossSpawn.stopRespawn();
    + SpawnTable.getInstance().deleteSpawn(_bossSpawn, true);
    + }
    +
    + public static void clear()
    + {
    + _players.clear();
    + player1 = null;
    + player2 = null;
    + winner = null;
    + loser = null;
    + ativo = false;
    + registro = false;
    + teleporte = false;
    + reward = false;
    + waitSecs(1);
    + lutando = false;
    + }
    +
    + public static void waitSecs(int i)
    + {
    + try
    + {
    + Thread.sleep(i * 1000);
    + }
    + catch (InterruptedException ie)
    + {
    + ie.printStackTrace();
    + }
    + }
    +
    + public static void endReward()
    + {
    + if (_players.size() == 1)
    + {
    + player1 = _players.getFirst();
    + player1.setHeroAura(true);
    + teleport(true);
    + player1.getInventory().addItem("Event", Config.LASTMAN_ITEM, Config.LASTMAN_ITEM_QUANTIA, player1, null);
    + reward = false;
    + }
    + }
    +
    + public static void wait(int i)
    + {
    + try
    + {
    + Thread.sleep(i * 60000);
    + }
    + catch (InterruptedException ie)
    + {
    + ie.printStackTrace();
    + }
    + }
    +
    + public static void setUserData()
    + {
    + final FastList<L2PcInstance> players = getPlayers();
    +
    + for (final L2PcInstance player : players)
    + {
    + player._originalColorTitle = player.getAppearance().getTitleColor();
    + player._originaltitlelast = player.getTitle();
    + player.getAppearance().setTitleColor(Config.LASTMANCOLOR);
    + player.setTitle("LastMan Event");
    + player.setKarma(0);
    + player.broadcastUserInfo();
    + }
    + }
    +
    + /**
    + * Close aden colosseum doors.
    + */
    + private static void closeAdenColosseumDoors()
    + {
    + DoorTable.getInstance().getDoor(24190002).closeMe();
    + DoorTable.getInstance().getDoor(24190003).closeMe();
    +
    + try
    + {
    + Thread.sleep(20);
    + }
    + catch (InterruptedException ie)
    + {
    + if (Config.ENABLE_ALL_EXCEPTIONS)
    + ie.printStackTrace();
    +
    + }
    + }
    +
    + /**
    + * Open aden colosseum doors.
    + */
    + private static void openAdenColosseumDoors()
    + {
    + DoorTable.getInstance().getDoor(24190002).openMe();
    + DoorTable.getInstance().getDoor(24190003).openMe();
    +
    + }
    +
    + protected synchronized static FastList<L2PcInstance> getPlayers()
    + {
    + return _players;
    + }
    +
    +}
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java (working copy)
    @@ -20,6 +20,7 @@
    import com.l2jfrozen.gameserver.model.actor.instance.L2SummonInstance;
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;

    @@ -31,7 +32,7 @@
    private int _originY;
    private int _originZ;
    private int _attackId;
    -
    +
    @Override
    protected void readImpl()
    {
    @@ -41,7 +42,7 @@
    _originZ = readD();
    _attackId = readC(); // 0 for simple click - 1 for shift-click
    }
    -
    +
    @Override
    protected void runImpl()
    {
    @@ -68,80 +69,84 @@
    return;

    // Players can't attack objects in the other instances except from multiverse
    - if (target.getInstanceId() != activeChar.getInstanceId()
    - && activeChar.getInstanceId() != -1)
    + if (target.getInstanceId() != activeChar.getInstanceId() && activeChar.getInstanceId() != -1)
    return;

    // Only GMs can directly attack invisible characters
    - if (target instanceof L2PcInstance
    - && ((L2PcInstance)target).getAppearance().getInvisible()
    - && !activeChar.isGM())
    - return;
    + if (target instanceof L2PcInstance) {
    + L2PcInstance player = (L2PcInstance)target;
    + if (player.getAppearance().getInvisible() && !activeChar.isGM()
    + || player.inLASTMAN == true && !activeChar.inLASTMAN == true
    + || !player.inLASTMAN == true && activeChar.inLASTMAN == true) {
    + getClient().sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    + }

    // During teleport phase, players cant do any attack

    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)
    @@ -33,6 +33,9 @@
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBan;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBuffs;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCTFEngine;
    +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminLastMan;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCache;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCharSupervision;
    @@ -119,11 +122,14 @@
    {
    _datatable = new FastMap<String, IAdminCommandHandler>();
    registerAdminCommandHandler(new AdminAdmin());
    registerAdminCommandHandler(new AdminInvul());
    + registerAdminCommandHandler(new AdminLastMan());
    registerAdminCommandHandler(new AdminDelete());
    registerAdminCommandHandler(new AdminKill());

    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/InitialEvents.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/InitialEvents.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/InitialEvents.java (working copy)
    @@ -0,0 +1,110 @@
    + package com.l2jfrozen.gameserver;
    +
    + import java.text.SimpleDateFormat;
    + import java.util.Calendar;
    + import java.util.logging.Logger;
    +
    + import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
    +
    + /**
    + *
    + * @author AxceLKuhn
    + *
    + */
    + public class InitialEvents
    + {
    + //Variaveis globais
    + private static InitialEvents _instance = null;
    + protected static final Logger _log = Logger.getLogger(InitialEvents.class.getName());
    + private Calendar NextRestart;
    + private SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    +
    + //Singleton
    + public static InitialEvents getInstance()
    + {
    + if(_instance == null)
    + _instance = new InitialEvents();
    + return _instance;
    + }
    +
    + public String getRestartNextTime()
    + {
    + if(NextRestart.getTime() != null)
    + return format.format(NextRestart.getTime());
    + else
    + return "Erro";
    + }
    +
    + //Connstrutor
    + private InitialEvents()
    + {
    + //:D
    + }
    +
    + public void StartCalculationOfNextRestartTime()
    + {
    + _log.info("#####################################");
    + _log.info("#[LastMan System]: System actived...#");
    + _log.info("#####################################");
    + try
    + {
    + Calendar currentTime = Calendar.getInstance();
    + Calendar testStartTime = null;
    + long flush2 = 0,timeL = 0;
    + int count = 0;
    +
    + for (String timeOfDay : Config.LASTMAN_INTERVAL_BY_TIME_OF_DAY)
    + {
    + testStartTime = Calendar.getInstance();
    + testStartTime.setLenient(true);
    + String[] splitTimeOfDay = timeOfDay.split(":");
    + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
    + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
    + testStartTime.set(Calendar.SECOND, 00);
    + //Verifica a validade to tempo
    + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
    + {
    + testStartTime.add(Calendar.DAY_OF_MONTH, 1);
    + }
    +
    + //TimeL Recebe o quanto falta de milisegundos para o restart
    + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis();
    +
    + //Verifica qual horario sera o proximo restart
    + if(count == 0){
    + flush2 = timeL;
    + NextRestart = testStartTime;
    + }
    +
    + if(timeL < flush2){
    + flush2 = timeL;
    + NextRestart = testStartTime;
    + }
    +
    + count ++;
    + }
    + _log.info("[AutoRestart]: Next Restart Time: " + NextRestart.getTime().toString());
    + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2);
    + }
    + catch (Exception e)
    + {
    + System.out.println("[LastMan]: The LastMan automated server presented error in load restarts period config !");
    + }
    + }
    +
    + class StartRestartTask implements Runnable
    + {
    + public void run()
    + {
    +LastMan.evento();
    +InitialEvents.getInstance().StartCalculationOfNextRestartTime();
    +return;
    + }
    + }
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy)
    @@ -11349,4 +11349,4 @@
    this.sendPacket(su);
    su = null;
    }
    -}
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/network/L2GameClient.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (working copy)
    @@ -838,6 +838,19 @@
    L2PcInstance player = L2GameClient.this.getActiveChar();
    if (player != null) // this should only happen on connection loss
    {
    + if(player.inLASTMAN == true)
    + {
    + player.getAppearance().setTitleColor(player._originalColorTitle);
    + player.setTitle(player._originaltitlelast);
    + com.l2jfrozen.gameserver.model.entity.event.LastMan._players.remove(player);
    + player.inLASTMAN = false;
    + player.teleToLocation(82813, 148344, -3471);
    + player.setKarma(0);
    + }
    // we store all data from players who are disconnected while in an event in order to restore it in the next login
    if(player.atEvent)
    {

    Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java (working copy)
    @@ -0,0 +1,108 @@
    +/* This program is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation; either version 2, or (at your option)
    + * any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program; if not, write to the Free Software
    + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    + * 02111-1307, USA.
    + *
    + * http://www.gnu.org/copyleft/gpl.html
    + */
    +package com.l2jfrozen.gameserver.model.actor.instance;
    +
    +import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.ai.CtrlIntention;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    +import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
    +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
    +import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
    +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    +
    +/**
    + * @author Axcel Kuhn
    + */
    +public class L2LastManInstance extends L2FolkInstance
    + {
    + public L2LastManInstance(int objectId, L2NpcTemplate template)
    + {
    + super(objectId, template);
    + }
    +
    + @Override
    + public void onAction(L2PcInstance player)
    + {
    + if (!canTarget(player))
    + return;
    +
    + player.setLastFolkNPC(this);
    +
    + // Check if the L2PcInstance already target the L2NpcInstance
    + if (this != player.getTarget())
    + {
    + // Set the target of the L2PcInstance player
    + player.setTarget(this);
    +
    + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
    + player.sendPacket(my);
    + my = null;
    +
    + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
    + player.sendPacket(new ValidateLocation(this));
    + }
    + else
    + {
    + // Calculate the distance between the L2PcInstance and the L2NpcInstance
    + if (!canInteract(player))
    + {
    + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT
    + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
    + }
    + else
    + {
    + showMessageWindow(player);
    + }
    + }
    + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + }
    +
    + private void showMessageWindow(L2PcInstance player)
    + {
    + String filename = "data/html/mods/LastMan/start.htm";
    +
    + NpcHtmlMessage html = new NpcHtmlMessage(1);
    + html.setFile(filename);
    + html.replace("%objectId%", String.valueOf(getObjectId()));
    + html.replace("%servername%", Config.ALT_Server_Name);
    + player.sendPacket(html);
    + filename = null;
    + html = null;
    + }
    +
    +
    +
    + @Override
    + public void onBypassFeedback(L2PcInstance player, String command)
    + {
    +
    + if (command.startsWith("registro"))
    + {
    +LastMan.register(player);
    + }
    + else if (command.startsWith("remove"))
    + {
    + LastMan.unregister(player);
    + }
    + }
    +
    +
    +}
    \ No newline at end of file

    Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java (working copy)
    @@ -28,6 +28,7 @@
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.model.entity.siege.Castle;
    import com.l2jfrozen.gameserver.model.entity.siege.Fort;
    @@ -60,10 +61,22 @@
    L2PcInstance player = (L2PcInstance) cha;
    _access = player.getAccessLevel();
    _clan = player.getClan();
    + if(player.inLASTMAN == true && com.l2jfrozen.gameserver.model.entity.event.LastMan.ativo == true)
    + {
    + player.getAppearance().setTitleColor(player._originalColorTitle);
    + player.setTitle(player._originaltitlelast);
    + com.l2jfrozen.gameserver.model.entity.event.LastMan._players.remove(player);
    + player.inLASTMAN = false;
    + player.doRevive();
    + player.teleToLocation(82813, 148344, -3471);
    + player.sendMessage("You have been moved to giran");
    + player.setKarma(0);
    + player.broadcastStatusUpdate();
    + }
    _canTeleport = !((TvT.is_started() && player._inEventTvT)
    || (DM.is_started() && player._inEventDM)
    || (CTF.is_started() && player._inEventCTF)
    - || player.isInFunEvent()
    + || player.isInFunEvent() || (LastMan.ativo == true && player.inLASTMAN == true)
    || player.isPendingRevive());
    }
    _charObjId = cha.getObjectId();
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java (working copy)
    @@ -89,12 +89,16 @@
    }

    // Only GMs can directly interact with invisible characters
    - if (obj instanceof L2PcInstance
    - && (((L2PcInstance)obj).getAppearance().getInvisible())
    - && !activeChar.isGM())
    - {
    - getClient().sendPacket(ActionFailed.STATIC_PACKET);
    - return;
    + if (obj instanceof L2PcInstance) {
    + L2PcInstance player = (L2PcInstance)obj;
    + if (player.getAppearance().getInvisible() && !activeChar.isGM()
    + || player.inLASTMAN == true && !activeChar.inLASTMAN == true
    + || !player.inLASTMAN == true && activeChar.inLASTMAN == true){
    + getClient().sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    }

    // Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)

    Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java (working copy)
    @@ -0,0 +1,47 @@
    +
    +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
    +
    +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
    +
    +public class AdminLastMan implements IAdminCommandHandler
    +{
    +
    + public AdminLastMan()
    + {
    + }
    +
    + public boolean useAdminCommand(String command, L2PcInstance activeChar)
    + {
    + if (command.startsWith("admin_lastman"))
    + {
    + try
    + {
    + ThreadPoolManager.getInstance().scheduleGeneral(new LastMan(), 1);
    +
    + }
    + catch (Exception e)
    + {
    + activeChar.sendMessage("Usage: //lastman");
    + }
    + }
    + return true;
    + }
    +
    + public String[] getAdminCommandList()
    + {
    + return ADMIN_COMMANDS;
    + }
    +
    + private static final String ADMIN_COMMANDS[] =
    + {
    + "admin_lastman"
    + };
    +
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
    @@ -143,6 +143,7 @@
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    import com.l2jfrozen.gameserver.model.entity.event.L2Event;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.model.entity.event.VIP;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;

    @@ -20209,17 +19299,65 @@
    {
    for (L2Skill s : HeroSkillTable.getHeroSkills())
    {
    - addSkill(s, false); //Dont Save Hero skills to database
    + addSkill(s, false); // Dont Save Hero skills to database
    }
    sendSkillList();
    }
    -
    +
    public void removeHeroSkills()
    {
    for (L2Skill s : HeroSkillTable.getHeroSkills())
    {
    - super.removeSkill(s); //Just Remove skills from nonHero characters
    + super.removeSkill(s); // Just Remove skills from nonHero characters
    }
    sendSkillList();
    }
    @@ -19323,17 +19348,22 @@
    {
    return inArenaEvent;
    }
    -
    private int arenaDefeats;
    private int arenaWins;

    +
    + public boolean inLASTMAN = false;
    + public boolean ForaLastMan = true;
    + public int _originalColorTitle;
    + public String _originaltitlelast;
    + public static boolean revive = false;
    +
    +
    +
    + public boolean isInLastMan()
    + {
    + return inLASTMAN;
    + }
    +
    }
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/Config.java
    ===================================================================
    --- head-src/com/l2jfrozen/Config.java (revision 986)
    +++ head-src/com/l2jfrozen/Config.java (working copy)

    @@ -612,11 +623,67 @@
    public static int FS_TIME_ATTACK;
    public static int FS_TIME_COOLDOWN;
    public static int FS_TIME_ENTRY;
    +
    public static int FS_TIME_WARMUP;
    public static int FS_PARTY_MEMBER_COUNT;
    + public static boolean LASTMAN_BY_TIME_OF_DAY;
    + public static String[] LASTMAN_INTERVAL_BY_TIME_OF_DAY;
    public static boolean ALLOW_QUAKE_SYSTEM;
    public static boolean ENABLE_ANTI_PVP_FARM_MSG;

    //============================================================
    @@ -634,7 +701,10 @@
    DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
    ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False"));
    EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True"));
    + LASTMANCOLOR = Integer.decode("0x" + otherSettings.getProperty("LASTMANCOLOR", "00FF00"));
    WYVERN_SPEED = Integer.parseInt(otherSettings.getProperty("WyvernSpeed", "100"));
    + LASTMAN_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableLastManSystem", "false"));
    + LASTMAN_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("LastManByTimeOfDay", "20:00").split(",");
    STRIDER_SPEED = Integer.parseInt(otherSettings.getProperty("StriderSpeed", "80"));
    ALLOW_WYVERN_UPGRADER = Boolean.valueOf(otherSettings.getProperty("AllowWyvernUpgrader", "False"));

    @@ -660,6 +759,15 @@
    MP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("MpRegenMultiplier", "100")) / 100;
    CP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("CpRegenMultiplier", "100")) / 100;

    +
    + LASTMAN_ITEM_QUANTIA = Integer.parseInt(otherSettings.getProperty("LastManItemQuantia", "1"));
    + LASTMAN_ID_NPC = Integer.parseInt(otherSettings.getProperty("LastManNpcId", "93000"));
    + LASTMAN_ITEM = Integer.parseInt(otherSettings.getProperty("LastManItemId", "3470"));
    + LMS_MIN_PLAYERS = Integer.parseInt(otherSettings.getProperty("LMSEventMinPlayers", "2"));
    + LMS_MAX_PLAYERS = Integer.parseInt(otherSettings.getProperty("LMSEventMaxPlayers", "5"));
    + LASTMAN_X_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocX", "149767"));
    + LASTMAN_Y_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocY", "46731"));
    + LASTMAN_Z_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocZ", "-3415"));
    +
    +
    RAID_HP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidHpRegenMultiplier", "100")) / 100;
    RAID_MP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidMpRegenMultiplier", "100")) / 100;
    RAID_P_DEFENCE_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidPhysicalDefenceMultiplier", "100")) / 100;
    @@ -2543,6 +2658,7 @@
    public static int PVP_AMOUNT4;
    public static int PVP_AMOUNT5;
    public static int NAME_COLOR_FOR_PVP_AMOUNT1;
    + public static int LASTMANCOLOR;
    public static int NAME_COLOR_FOR_PVP_AMOUNT2;
    public static int NAME_COLOR_FOR_PVP_AMOUNT3;
    public static int NAME_COLOR_FOR_PVP_AMOUNT4;
    @@ -4246,7 +4362,14 @@

    //============================================================
    private static final String HEXID_FILE = FService.HEXID_FILE;
    +
    + public static int LASTMAN_ITEM_QUANTIA;
    + public static int LASTMAN_ID_NPC;
    + public static int LASTMAN_ITEM;
    + public static int LMS_MIN_PLAYERS;
    + public static int LMS_MAX_PLAYERS;
    public static int SERVER_ID;
    + public static int LASTMAN_X_ARENA;
    + public static int LASTMAN_Y_ARENA;
    + public static int LASTMAN_Z_ARENA;
    public static byte[] HEX_ID;

    //============================================================
    Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java (working copy)
    @@ -0,0 +1,26 @@
    +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
    +
    +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +
    +public class eventlhe implements IVoicedCommandHandler
    +{
    + private static final String[] _voicedCommands = { "joinlm", "leavelm" };
    +
    + @Override
    + public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)
    + {
    + if (command.equals("joinlm"))
    + LastMan.register(activeChar);
    + if (command.equals("leavelm"))
    + LastMan.unregister(activeChar);
    + return true;
    + }
    +
    + @Override
    + public String[] getVoicedCommandList()
    + {
    + return _voicedCommands;
    + }
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (working copy)
    @@ -85,6 +85,12 @@
    return;
    }

    + if(player.inLASTMAN == true)
    + {
    + player.sendMessage("You cannot Logout while in registered in an Event.");
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    // Check if player is in combat
    if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
    {
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java (working copy)
    @@ -22,8 +22,11 @@
    import com.l2jfrozen.gameserver.model.L2Character;
    import com.l2jfrozen.gameserver.model.L2Party;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.Announcements;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
    import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
    +import com.l2jfrozen.gameserver.network.L2GameClient;
    import com.l2jfrozen.gameserver.network.SystemMessageId;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
    @@ -32,7 +35,6 @@
    public final class Logout extends L2GameClientPacket
    {
    private static Logger _log = Logger.getLogger(Logout.class.getName());
    -
    @Override
    protected void readImpl()
    {
    @@ -47,12 +49,27 @@
    if (player == null)
    return;

    + if(player.inLASTMAN == true)
    + {
    + player.sendMessage("You cannot Logout while in registered in an Event.");
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    +
    if (player.isInFunEvent() && !player.isGM())
    {
    player.sendMessage("You cannot Logout while in registered in an Event.");
    player.sendPacket(ActionFailed.STATIC_PACKET);
    return;
    }
    +

    if (player.isAway())
    {

    Desconectado UndergrOundCodes

    • Grado C
    • *
    • Mensajes: 112
    • 00
    • Agradecimientos: 69
    • Enjoy the game
      • Facebook Page
    • Cronica: : Interlude
    • Revision: ultima
    • S.O: Windows 7
    • Serverpack : jfrozen
    Re:[JFROZEN REV 1132] Error evento Last Man
    « Respuesta #1 en: Marzo 27, 2020, 01:27:39 am »
    gracias
    Este post tiene 0 agradecimientos
  • Añade a tus favoritos
  • hola, como estan? espero que alguien me pueda ayudar.

    Agregue el evento Last Man a jfrozen rev 1132. El problema es que me esta dando error en 4 lineas de LastMan.java


    Código: [Seleccionar]
    if (p.getKarma() > 0) {

    -

    Código: [Seleccionar]
     p.sendPacket(new CreatureSay(1, Say2.PARTY, "LMS", "You cant not register because exceded the max players registered limit: "+ MaxPlayers + " players."));
    -

    Código: [Seleccionar]
    if (p.isInArenaEvent())
    -

    Código: [Seleccionar]
    if (EvtArenaManager.getInstance().isRegistered(p))


    Adjunto el codigo original. Espero que alguien me pueda ayudar :(

    CODIGO COMPLETO


    Código: [Seleccionar]
    Evento Last Man para Jfrozen

    Autor: AdvenTeam

    --- data/html/mods/LastMan/start.htm (revision 0)
    +++ data/html/mods/LastMan/start.htm (working copy)
    @@ -0,0 +1,27 @@
    ++<html>
    +<title>Last Man By Axcel</title>
    + <body>
    + <br>
    + <center><img src=L2UI.SquareWhite width=276 height=1></center>
    + <center>
    + <table width=256>
    + <tr>
    + <td><img src=L2UI.GM_Icon width=32 height=32></td>
    + <td width=192 align=center>
    + <font color="LEVEL">%servername%</font><br1>Bem Vindo!
    + </td>
    + <td><img src=L2UI.GM_Icon width=32 height=32></td>
    + </tr>
    + </table>
    + </center>
    + <br>
    + <center><img src=L2UI.SquareWhite width=276 height=1></center>
    + <br>
    + <center>
    + <font color=FF9900>Evento LastMan(Free for All).</font><br>
    + <button value="Registro" action="bypass -h npc_%objectId%_registro" width=100 height=15 back="sek.cbui94" fore="sek.cbui92"><br>
    + <button value="Remover" action="bypass -h npc_%objectId%_remove" width=100 height=15 back="sek.cbui94" fore="sek.cbui92"><br>
    + <font color=0099FF>O ultimo que sobreviver ira ganhar um premio !!.</font>
    + </center>
    + </body>
    +</html>
    \ No newline at end of file

    ### Eclipse Workspace Patch 1.0
    #P L2jAiren
    Index: config/head/other.properties
    ===================================================================
    --- config/head/other.properties (revision 986)
    +++ config/head/other.properties (working copy)
    @@ -4,6 +4,71 @@
    # Pack: l2jfrozen Site: www.l2jfrozen.com #
    #============================================================#

    +###########################################
    +# LastMan config #
    +# #########################################
    +# Enable / Disable Restart Auto
    +EnableLastManSystem = True
    +
    +# If EnableLastManSystem = True Describe hours of the day
    + Example: 22:00,23:00 (hh:mm,hh:mm...)
    +# NOTE: Separate ":" mm:hh and "," others restart time
    +LastManByTimeOfDay = 00:00,12:00
    +
    +# ID do npc que sera setado como L2LastManInstance
    +LastManNpcId = 93000
    +
    +# Id do item que o player vai ganhar
    +LastManItemId = 3470
    +
    +#Quantidade de itens que o player vai ganhar
    +LastManItemQuantia = 1
    +
    # Min / Max players can join in event
    LMSEventMinPlayers = 2
    LMSEventMaxPlayers = 5

    +# Loc da arena
    +#Coliseum default
    +#Loc x
    +LastManArenalocX = 149767
    +#Loc y
    +LastManArenalocY = 46731
    +#Loc z
    +LastManArenalocZ = -3415


    ### Eclipse Workspace Patch 1.0
    #P L2jAiren
    Index: head-src/com/l2jfrozen/gameserver/GameServer.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy)
    @@ -119,6 +119,7 @@
    import com.l2jfrozen.gameserver.model.entity.Announcements;
    import com.l2jfrozen.gameserver.model.entity.Hero;
    import com.l2jfrozen.gameserver.model.entity.MonsterRace;
    import com.l2jfrozen.gameserver.model.entity.event.manager.EventManager;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
    import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSigns;
    @@ -196,6 +197,7 @@

    Util.printSection("Team");

    +
    // Print L2jfrozen's Logo
    L2Frozen.info();

    @@ -559,9 +561,21 @@
    else
    _log.info("All events are Disabled.");

    if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
    OfflineTradeTable.restoreOfflineTraders();

    + Util.printSection("LastMan Manager");
    + if(Config.LASTMAN_BY_TIME_OF_DAY)
    + InitialEvents.getInstance().StartCalculationOfNextRestartTime();
    + else
    + _log.info("# Auto LastMan System is Disabled #");
    +
    + System.gc();
    +
    Util.printSection("Info");
    _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch());
    _log.info("Available CPUs: " + Util.getAvailableProcessors());

    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
    @@ -37,6 +37,7 @@
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.VersionCmd;
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
    import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
    +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.eventlhe;

    /**
    * This class ...
    @@ -65,6 +66,7 @@
    _datatable = new FastMap<String, IVoicedCommandHandler>();

    registerVoicedCommandHandler(new Voting());
    + registerVoicedCommandHandler(new eventlhe());

    if (Config.BANKING_SYSTEM_ENABLED)
    {
    @@ -85,7 +87,7 @@
    {
    registerVoicedCommandHandler(new DMCmd());
    }
    -
    +
    if (Config.L2JMOD_ALLOW_WEDDING)
    {
    registerVoicedCommandHandler(new Wedding());
    Index: head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/model/entity/event/LastMan.java (working copy)
    @@ -0,0 +1,332 @@
    +package com.l2jfrozen.gameserver.model.entity.event;
    +
    +import javolution.util.FastList;
    +
    +import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
    +import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
    +import com.l2jfrozen.gameserver.datatables.sql.SpawnTable;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.Announcements;
    +import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
    +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    +import com.l2jfrozen.util.random.Rnd;
    + import com.l2jfrozen.gameserver.network.clientpackets.Say2;
    + import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
    +
    +/**
    + * This class ...
    + * @version $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $
    + */
    +public class LastMan implements Runnable
    +{
    + public static FastList<L2PcInstance> _players = new FastList<L2PcInstance>();
    + public static L2PcInstance winner = null;
    + public static L2PcInstance loser = null;
    + public static L2PcInstance player1 = null;
    + public static L2Spawn _bossSpawn;
    + public static String _eventName = "";
    + public static int _bossHeading = 0;
    + public static int MinPlayers = Config.LMS_MIN_PLAYERS;
    + public static int MaxPlayers = Config.LMS_MAX_PLAYERS;
    + public static L2PcInstance player2 = null;
    + public static boolean ativo = false;
    + public static boolean registro = false;
    + public static boolean teleporte = false;
    + public static boolean reward = false;
    + public static boolean lutando = false;
    +
    + @Override
    + public void run()
    + {
    + if (ativo == true)
    + {
    + return;
    + }
    + evento();
    +
    + }
    +
    + public static void evento()
    + {
    + registro = true;
    + ativo = true;
    + NpcSpawnLastMan();
    + Announcements.getInstance().gameAnnounceToAll("LastMan Started");
    + Announcements.getInstance().gameAnnounceToAll("5 minute(s) till registration close");
    + Announcements.getInstance().gameAnnounceToAll("Use to .joinlm or .leavelm or go to giran");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("4 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("3 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("2 minute(s) till registration close");
    + wait(1);
    + Announcements.getInstance().gameAnnounceToAll("1 minute(s) till registration close");
    + wait(1);
    + unspawnNpcLastMan();
    + if (_players.size() < Config.LMS_MIN_PLAYERS)
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.inLASTMAN = false;
    + }
    + Announcements.getInstance().gameAnnounceToAll("Not enough players for event, min: "+ MinPlayers +" players.");
    + Announcements.getInstance().gameAnnounceToAll("Last Man Event: Match Aborted!");
    + clear();
    + return;
    + }
    if (p.getKarma() > 0) {
    Announcements.getInstance().gameAnnounceToAll("You can not register, you have karma.");
    return;
    }

    + if (_players.size() >= Config.LMS_MAX_PLAYERS) {
    + p.sendPacket(new CreatureSay(1, Say2.PARTY, "LMS", "You cant not register because exceded the max players registered limit: "+ MaxPlayers + " players."));
    + return;
    + }
    + closeAdenColosseumDoors();
    + registro = false;
    + setUserData();
    + teleporte = true;
    + teleport(false);
    + prepare();
    + Announcements.getInstance().gameAnnounceToAll("You have 45 seconds to get prepared");
    + waitSecs(45);
    + start();
    + reward = true;
    + while (reward == true)
    + {
    + waitSecs(3);
    + endReward();
    + }
    + Announcements.getInstance().gameAnnounceToAll("The event LastMan ended the winner was " + player1 + " congratulations!");
    + waitSecs(1);
    + player1.inLASTMAN = false;
    + openAdenColosseumDoors();
    + clear();
    + }
    +
    + public static void teleport(boolean back)
    + {
    + if (!back)
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.restoreCP();
    + p.restoreHPMP();
    + p.teleToLocation(Config.LASTMAN_X_ARENA + Rnd.get(401) - 100, Config.LASTMAN_Y_ARENA + Rnd.get(301) - 100, Config.LASTMAN_Z_ARENA);
    + p.sendMessage("You have been moved to coliseum");
    + }
    + }
    + else
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.teleToLocation(82813, 148344, -3471);
    + p.sendMessage("You have been moved to giran");
    + }
    + }
    + }
    +
    + public static void register(L2PcInstance p)
    + {
    +
    + if (_players.contains(p))
    + {
    + p.sendMessage("You have already register");
    + return;
    + }
    + if (registro == false)
    + {
    + p.sendMessage("Can't register now");
    + return;
    + }
    + if (p.isInOlympiadMode())
    + {
    + p.sendMessage("You can't register while you have register for olympiad match");
    + return;
    + }
    + if (p.isInFunEvent())
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (p.isInArenaEvent())
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (EvtArenaManager.getInstance().isRegistered(p))
    + {
    + p.sendMessage("You can't register while you have register for other Event");
    + return;
    + }
    + if (p.getKarma() > 0)
    + {
    + p.sendMessage("You can not register pk");
    + return;
    + }
    + _players.add(p);
    + p.sendMessage("You successfully registered for the event");
    + p.inLASTMAN = true;
    + }
    +
    + public static void unregister(L2PcInstance p)
    + {
    + if (!_players.contains(p))
    + {
    + p.sendMessage("You have already unregister");
    + return;
    + }
    +
    + if (registro == false)
    + {
    + p.sendMessage("You can't unregister while match is about to begin");
    + return;
    + }
    +
    + _players.remove(p);
    + p.sendMessage("Succesfully unregistered");
    + p.inLASTMAN = false;
    + }
    +
    + public static void prepare()
    + {
    + for (L2PcInstance p : _players)
    + {
    + p.stopAllEffects();
    + p.setIsInvul(true);
    + p.sendMessage("You have 45 seconds to get prepared");
    + }
    + }
    +
    + public static void start()
    + {
    + lutando = true;
    +
    + for (L2PcInstance p : _players)
    + {
    + p.stopRooting(null);
    + p.setIsInvul(false);
    + p.sendMessage("Go go go,start fighting");
    + }
    + }
    +
    + private static void NpcSpawnLastMan()
    + {
    + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.LASTMAN_ID_NPC);// ID do mob
    + try
    + {
    + _bossSpawn = new L2Spawn(tmpl);
    +
    + _bossSpawn.setLocx(82640); // loc x
    + _bossSpawn.setLocy(148519); // loc y
    + _bossSpawn.setLocz(-3472); // loc z
    + _bossSpawn.setAmount(1);
    + _bossSpawn.setHeading(0);
    + _bossSpawn.setRespawnDelay(1);
    +
    + SpawnTable.getInstance().addNewSpawn(_bossSpawn, false);
    +
    + _bossSpawn.init();
    + _bossSpawn.getLastSpawn().setTitle(_eventName);
    + _bossSpawn.getLastSpawn().isAggressive();
    + _bossSpawn.getLastSpawn().decayMe();
    + _bossSpawn.getLastSpawn().spawnMe(_bossSpawn.getLastSpawn().getX(), _bossSpawn.getLastSpawn().getY(), _bossSpawn.getLastSpawn().getZ());
    + }
    + catch (Exception e)
    + {
    + System.out.println("Erro no evento");
    + }
    + }
    +
    + private static void unspawnNpcLastMan()
    + {
    + if (_bossSpawn == null || _bossSpawn.getLastSpawn() == null)
    + return;
    +
    + _bossSpawn.getLastSpawn().deleteMe();
    + _bossSpawn.stopRespawn();
    + SpawnTable.getInstance().deleteSpawn(_bossSpawn, true);
    + }
    +
    + public static void clear()
    + {
    + _players.clear();
    + player1 = null;
    + player2 = null;
    + winner = null;
    + loser = null;
    + ativo = false;
    + registro = false;
    + teleporte = false;
    + reward = false;
    + waitSecs(1);
    + lutando = false;
    + }
    +
    + public static void waitSecs(int i)
    + {
    + try
    + {
    + Thread.sleep(i * 1000);
    + }
    + catch (InterruptedException ie)
    + {
    + ie.printStackTrace();
    + }
    + }
    +
    + public static void endReward()
    + {
    + if (_players.size() == 1)
    + {
    + player1 = _players.getFirst();
    + player1.setHeroAura(true);
    + teleport(true);
    + player1.getInventory().addItem("Event", Config.LASTMAN_ITEM, Config.LASTMAN_ITEM_QUANTIA, player1, null);
    + reward = false;
    + }
    + }
    +
    + public static void wait(int i)
    + {
    + try
    + {
    + Thread.sleep(i * 60000);
    + }
    + catch (InterruptedException ie)
    + {
    + ie.printStackTrace();
    + }
    + }
    +
    + public static void setUserData()
    + {
    + final FastList<L2PcInstance> players = getPlayers();
    +
    + for (final L2PcInstance player : players)
    + {
    + player._originalColorTitle = player.getAppearance().getTitleColor();
    + player._originaltitlelast = player.getTitle();
    + player.getAppearance().setTitleColor(Config.LASTMANCOLOR);
    + player.setTitle("LastMan Event");
    + player.setKarma(0);
    + player.broadcastUserInfo();
    + }
    + }
    +
    + /**
    + * Close aden colosseum doors.
    + */
    + private static void closeAdenColosseumDoors()
    + {
    + DoorTable.getInstance().getDoor(24190002).closeMe();
    + DoorTable.getInstance().getDoor(24190003).closeMe();
    +
    + try
    + {
    + Thread.sleep(20);
    + }
    + catch (InterruptedException ie)
    + {
    + if (Config.ENABLE_ALL_EXCEPTIONS)
    + ie.printStackTrace();
    +
    + }
    + }
    +
    + /**
    + * Open aden colosseum doors.
    + */
    + private static void openAdenColosseumDoors()
    + {
    + DoorTable.getInstance().getDoor(24190002).openMe();
    + DoorTable.getInstance().getDoor(24190003).openMe();
    +
    + }
    +
    + protected synchronized static FastList<L2PcInstance> getPlayers()
    + {
    + return _players;
    + }
    +
    +}
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/AttackRequest.java (working copy)
    @@ -20,6 +20,7 @@
    import com.l2jfrozen.gameserver.model.actor.instance.L2SummonInstance;
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;

    @@ -31,7 +32,7 @@
    private int _originY;
    private int _originZ;
    private int _attackId;
    -
    +
    @Override
    protected void readImpl()
    {
    @@ -41,7 +42,7 @@
    _originZ = readD();
    _attackId = readC(); // 0 for simple click - 1 for shift-click
    }
    -
    +
    @Override
    protected void runImpl()
    {
    @@ -68,80 +69,84 @@
    return;

    // Players can't attack objects in the other instances except from multiverse
    - if (target.getInstanceId() != activeChar.getInstanceId()
    - && activeChar.getInstanceId() != -1)
    + if (target.getInstanceId() != activeChar.getInstanceId() && activeChar.getInstanceId() != -1)
    return;

    // Only GMs can directly attack invisible characters
    - if (target instanceof L2PcInstance
    - && ((L2PcInstance)target).getAppearance().getInvisible()
    - && !activeChar.isGM())
    - return;
    + if (target instanceof L2PcInstance) {
    + L2PcInstance player = (L2PcInstance)target;
    + if (player.getAppearance().getInvisible() && !activeChar.isGM()
    + || player.inLASTMAN == true && !activeChar.inLASTMAN == true
    + || !player.inLASTMAN == true && activeChar.inLASTMAN == true) {
    + getClient().sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    + }

    // During teleport phase, players cant do any attack

    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)
    @@ -33,6 +33,9 @@
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBan;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBuffs;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCTFEngine;
    +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminLastMan;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCache;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
    import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCharSupervision;
    @@ -119,11 +122,14 @@
    {
    _datatable = new FastMap<String, IAdminCommandHandler>();
    registerAdminCommandHandler(new AdminAdmin());
    registerAdminCommandHandler(new AdminInvul());
    + registerAdminCommandHandler(new AdminLastMan());
    registerAdminCommandHandler(new AdminDelete());
    registerAdminCommandHandler(new AdminKill());

    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/InitialEvents.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/InitialEvents.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/InitialEvents.java (working copy)
    @@ -0,0 +1,110 @@
    + package com.l2jfrozen.gameserver;
    +
    + import java.text.SimpleDateFormat;
    + import java.util.Calendar;
    + import java.util.logging.Logger;
    +
    + import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
    +
    + /**
    + *
    + * @author AxceLKuhn
    + *
    + */
    + public class InitialEvents
    + {
    + //Variaveis globais
    + private static InitialEvents _instance = null;
    + protected static final Logger _log = Logger.getLogger(InitialEvents.class.getName());
    + private Calendar NextRestart;
    + private SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    +
    + //Singleton
    + public static InitialEvents getInstance()
    + {
    + if(_instance == null)
    + _instance = new InitialEvents();
    + return _instance;
    + }
    +
    + public String getRestartNextTime()
    + {
    + if(NextRestart.getTime() != null)
    + return format.format(NextRestart.getTime());
    + else
    + return "Erro";
    + }
    +
    + //Connstrutor
    + private InitialEvents()
    + {
    + //:D
    + }
    +
    + public void StartCalculationOfNextRestartTime()
    + {
    + _log.info("#####################################");
    + _log.info("#[LastMan System]: System actived...#");
    + _log.info("#####################################");
    + try
    + {
    + Calendar currentTime = Calendar.getInstance();
    + Calendar testStartTime = null;
    + long flush2 = 0,timeL = 0;
    + int count = 0;
    +
    + for (String timeOfDay : Config.LASTMAN_INTERVAL_BY_TIME_OF_DAY)
    + {
    + testStartTime = Calendar.getInstance();
    + testStartTime.setLenient(true);
    + String[] splitTimeOfDay = timeOfDay.split(":");
    + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
    + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
    + testStartTime.set(Calendar.SECOND, 00);
    + //Verifica a validade to tempo
    + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
    + {
    + testStartTime.add(Calendar.DAY_OF_MONTH, 1);
    + }
    +
    + //TimeL Recebe o quanto falta de milisegundos para o restart
    + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis();
    +
    + //Verifica qual horario sera o proximo restart
    + if(count == 0){
    + flush2 = timeL;
    + NextRestart = testStartTime;
    + }
    +
    + if(timeL < flush2){
    + flush2 = timeL;
    + NextRestart = testStartTime;
    + }
    +
    + count ++;
    + }
    + _log.info("[AutoRestart]: Next Restart Time: " + NextRestart.getTime().toString());
    + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2);
    + }
    + catch (Exception e)
    + {
    + System.out.println("[LastMan]: The LastMan automated server presented error in load restarts period config !");
    + }
    + }
    +
    + class StartRestartTask implements Runnable
    + {
    + public void run()
    + {
    +LastMan.evento();
    +InitialEvents.getInstance().StartCalculationOfNextRestartTime();
    +return;
    + }
    + }
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy)
    @@ -11349,4 +11349,4 @@
    this.sendPacket(su);
    su = null;
    }
    -}
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/network/L2GameClient.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (working copy)
    @@ -838,6 +838,19 @@
    L2PcInstance player = L2GameClient.this.getActiveChar();
    if (player != null) // this should only happen on connection loss
    {
    + if(player.inLASTMAN == true)
    + {
    + player.getAppearance().setTitleColor(player._originalColorTitle);
    + player.setTitle(player._originaltitlelast);
    + com.l2jfrozen.gameserver.model.entity.event.LastMan._players.remove(player);
    + player.inLASTMAN = false;
    + player.teleToLocation(82813, 148344, -3471);
    + player.setKarma(0);
    + }
    // we store all data from players who are disconnected while in an event in order to restore it in the next login
    if(player.atEvent)
    {

    Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2LastManInstance.java (working copy)
    @@ -0,0 +1,108 @@
    +/* This program is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation; either version 2, or (at your option)
    + * any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program; if not, write to the Free Software
    + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    + * 02111-1307, USA.
    + *
    + * http://www.gnu.org/copyleft/gpl.html
    + */
    +package com.l2jfrozen.gameserver.model.actor.instance;
    +
    +import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.ai.CtrlIntention;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    +import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
    +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
    +import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
    +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    +
    +/**
    + * @author Axcel Kuhn
    + */
    +public class L2LastManInstance extends L2FolkInstance
    + {
    + public L2LastManInstance(int objectId, L2NpcTemplate template)
    + {
    + super(objectId, template);
    + }
    +
    + @Override
    + public void onAction(L2PcInstance player)
    + {
    + if (!canTarget(player))
    + return;
    +
    + player.setLastFolkNPC(this);
    +
    + // Check if the L2PcInstance already target the L2NpcInstance
    + if (this != player.getTarget())
    + {
    + // Set the target of the L2PcInstance player
    + player.setTarget(this);
    +
    + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
    + player.sendPacket(my);
    + my = null;
    +
    + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
    + player.sendPacket(new ValidateLocation(this));
    + }
    + else
    + {
    + // Calculate the distance between the L2PcInstance and the L2NpcInstance
    + if (!canInteract(player))
    + {
    + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT
    + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
    + }
    + else
    + {
    + showMessageWindow(player);
    + }
    + }
    + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + }
    +
    + private void showMessageWindow(L2PcInstance player)
    + {
    + String filename = "data/html/mods/LastMan/start.htm";
    +
    + NpcHtmlMessage html = new NpcHtmlMessage(1);
    + html.setFile(filename);
    + html.replace("%objectId%", String.valueOf(getObjectId()));
    + html.replace("%servername%", Config.ALT_Server_Name);
    + player.sendPacket(html);
    + filename = null;
    + html = null;
    + }
    +
    +
    +
    + @Override
    + public void onBypassFeedback(L2PcInstance player, String command)
    + {
    +
    + if (command.startsWith("registro"))
    + {
    +LastMan.register(player);
    + }
    + else if (command.startsWith("remove"))
    + {
    + LastMan.unregister(player);
    + }
    + }
    +
    +
    +}
    \ No newline at end of file

    Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java (working copy)
    @@ -28,6 +28,7 @@
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.model.entity.siege.Castle;
    import com.l2jfrozen.gameserver.model.entity.siege.Fort;
    @@ -60,10 +61,22 @@
    L2PcInstance player = (L2PcInstance) cha;
    _access = player.getAccessLevel();
    _clan = player.getClan();
    + if(player.inLASTMAN == true && com.l2jfrozen.gameserver.model.entity.event.LastMan.ativo == true)
    + {
    + player.getAppearance().setTitleColor(player._originalColorTitle);
    + player.setTitle(player._originaltitlelast);
    + com.l2jfrozen.gameserver.model.entity.event.LastMan._players.remove(player);
    + player.inLASTMAN = false;
    + player.doRevive();
    + player.teleToLocation(82813, 148344, -3471);
    + player.sendMessage("You have been moved to giran");
    + player.setKarma(0);
    + player.broadcastStatusUpdate();
    + }
    _canTeleport = !((TvT.is_started() && player._inEventTvT)
    || (DM.is_started() && player._inEventDM)
    || (CTF.is_started() && player._inEventCTF)
    - || player.isInFunEvent()
    + || player.isInFunEvent() || (LastMan.ativo == true && player.inLASTMAN == true)
    || player.isPendingRevive());
    }
    _charObjId = cha.getObjectId();
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/Action.java (working copy)
    @@ -89,12 +89,16 @@
    }

    // Only GMs can directly interact with invisible characters
    - if (obj instanceof L2PcInstance
    - && (((L2PcInstance)obj).getAppearance().getInvisible())
    - && !activeChar.isGM())
    - {
    - getClient().sendPacket(ActionFailed.STATIC_PACKET);
    - return;
    + if (obj instanceof L2PcInstance) {
    + L2PcInstance player = (L2PcInstance)obj;
    + if (player.getAppearance().getInvisible() && !activeChar.isGM()
    + || player.inLASTMAN == true && !activeChar.inLASTMAN == true
    + || !player.inLASTMAN == true && activeChar.inLASTMAN == true){
    + getClient().sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    }

    // Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)

    Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminLastMan.java (working copy)
    @@ -0,0 +1,47 @@
    +
    +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
    +
    +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
    +
    +public class AdminLastMan implements IAdminCommandHandler
    +{
    +
    + public AdminLastMan()
    + {
    + }
    +
    + public boolean useAdminCommand(String command, L2PcInstance activeChar)
    + {
    + if (command.startsWith("admin_lastman"))
    + {
    + try
    + {
    + ThreadPoolManager.getInstance().scheduleGeneral(new LastMan(), 1);
    +
    + }
    + catch (Exception e)
    + {
    + activeChar.sendMessage("Usage: //lastman");
    + }
    + }
    + return true;
    + }
    +
    + public String[] getAdminCommandList()
    + {
    + return ADMIN_COMMANDS;
    + }
    +
    + private static final String ADMIN_COMMANDS[] =
    + {
    + "admin_lastman"
    + };
    +
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
    @@ -143,6 +143,7 @@
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    import com.l2jfrozen.gameserver.model.entity.event.L2Event;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.model.entity.event.VIP;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;

    @@ -20209,17 +19299,65 @@
    {
    for (L2Skill s : HeroSkillTable.getHeroSkills())
    {
    - addSkill(s, false); //Dont Save Hero skills to database
    + addSkill(s, false); // Dont Save Hero skills to database
    }
    sendSkillList();
    }
    -
    +
    public void removeHeroSkills()
    {
    for (L2Skill s : HeroSkillTable.getHeroSkills())
    {
    - super.removeSkill(s); //Just Remove skills from nonHero characters
    + super.removeSkill(s); // Just Remove skills from nonHero characters
    }
    sendSkillList();
    }
    @@ -19323,17 +19348,22 @@
    {
    return inArenaEvent;
    }
    -
    private int arenaDefeats;
    private int arenaWins;

    +
    + public boolean inLASTMAN = false;
    + public boolean ForaLastMan = true;
    + public int _originalColorTitle;
    + public String _originaltitlelast;
    + public static boolean revive = false;
    +
    +
    +
    + public boolean isInLastMan()
    + {
    + return inLASTMAN;
    + }
    +
    }
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/Config.java
    ===================================================================
    --- head-src/com/l2jfrozen/Config.java (revision 986)
    +++ head-src/com/l2jfrozen/Config.java (working copy)

    @@ -612,11 +623,67 @@
    public static int FS_TIME_ATTACK;
    public static int FS_TIME_COOLDOWN;
    public static int FS_TIME_ENTRY;
    +
    public static int FS_TIME_WARMUP;
    public static int FS_PARTY_MEMBER_COUNT;
    + public static boolean LASTMAN_BY_TIME_OF_DAY;
    + public static String[] LASTMAN_INTERVAL_BY_TIME_OF_DAY;
    public static boolean ALLOW_QUAKE_SYSTEM;
    public static boolean ENABLE_ANTI_PVP_FARM_MSG;

    //============================================================
    @@ -634,7 +701,10 @@
    DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
    ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False"));
    EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True"));
    + LASTMANCOLOR = Integer.decode("0x" + otherSettings.getProperty("LASTMANCOLOR", "00FF00"));
    WYVERN_SPEED = Integer.parseInt(otherSettings.getProperty("WyvernSpeed", "100"));
    + LASTMAN_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableLastManSystem", "false"));
    + LASTMAN_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("LastManByTimeOfDay", "20:00").split(",");
    STRIDER_SPEED = Integer.parseInt(otherSettings.getProperty("StriderSpeed", "80"));
    ALLOW_WYVERN_UPGRADER = Boolean.valueOf(otherSettings.getProperty("AllowWyvernUpgrader", "False"));

    @@ -660,6 +759,15 @@
    MP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("MpRegenMultiplier", "100")) / 100;
    CP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("CpRegenMultiplier", "100")) / 100;

    +
    + LASTMAN_ITEM_QUANTIA = Integer.parseInt(otherSettings.getProperty("LastManItemQuantia", "1"));
    + LASTMAN_ID_NPC = Integer.parseInt(otherSettings.getProperty("LastManNpcId", "93000"));
    + LASTMAN_ITEM = Integer.parseInt(otherSettings.getProperty("LastManItemId", "3470"));
    + LMS_MIN_PLAYERS = Integer.parseInt(otherSettings.getProperty("LMSEventMinPlayers", "2"));
    + LMS_MAX_PLAYERS = Integer.parseInt(otherSettings.getProperty("LMSEventMaxPlayers", "5"));
    + LASTMAN_X_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocX", "149767"));
    + LASTMAN_Y_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocY", "46731"));
    + LASTMAN_Z_ARENA = Integer.parseInt(otherSettings.getProperty("LastManArenalocZ", "-3415"));
    +
    +
    RAID_HP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidHpRegenMultiplier", "100")) / 100;
    RAID_MP_REGEN_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidMpRegenMultiplier", "100")) / 100;
    RAID_P_DEFENCE_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("RaidPhysicalDefenceMultiplier", "100")) / 100;
    @@ -2543,6 +2658,7 @@
    public static int PVP_AMOUNT4;
    public static int PVP_AMOUNT5;
    public static int NAME_COLOR_FOR_PVP_AMOUNT1;
    + public static int LASTMANCOLOR;
    public static int NAME_COLOR_FOR_PVP_AMOUNT2;
    public static int NAME_COLOR_FOR_PVP_AMOUNT3;
    public static int NAME_COLOR_FOR_PVP_AMOUNT4;
    @@ -4246,7 +4362,14 @@

    //============================================================
    private static final String HEXID_FILE = FService.HEXID_FILE;
    +
    + public static int LASTMAN_ITEM_QUANTIA;
    + public static int LASTMAN_ID_NPC;
    + public static int LASTMAN_ITEM;
    + public static int LMS_MIN_PLAYERS;
    + public static int LMS_MAX_PLAYERS;
    public static int SERVER_ID;
    + public static int LASTMAN_X_ARENA;
    + public static int LASTMAN_Y_ARENA;
    + public static int LASTMAN_Z_ARENA;
    public static byte[] HEX_ID;

    //============================================================
    Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java (revision 0)
    +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/eventlhe.java (working copy)
    @@ -0,0 +1,26 @@
    +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
    +
    +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    +
    +public class eventlhe implements IVoicedCommandHandler
    +{
    + private static final String[] _voicedCommands = { "joinlm", "leavelm" };
    +
    + @Override
    + public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)
    + {
    + if (command.equals("joinlm"))
    + LastMan.register(activeChar);
    + if (command.equals("leavelm"))
    + LastMan.unregister(activeChar);
    + return true;
    + }
    +
    + @Override
    + public String[] getVoicedCommandList()
    + {
    + return _voicedCommands;
    + }
    +}
    \ No newline at end of file
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (working copy)
    @@ -85,6 +85,12 @@
    return;
    }

    + if(player.inLASTMAN == true)
    + {
    + player.sendMessage("You cannot Logout while in registered in an Event.");
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    // Check if player is in combat
    if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
    {
    Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java
    ===================================================================
    --- head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java (revision 986)
    +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/Logout.java (working copy)
    @@ -22,8 +22,11 @@
    import com.l2jfrozen.gameserver.model.L2Character;
    import com.l2jfrozen.gameserver.model.L2Party;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.entity.Announcements;
    +import com.l2jfrozen.gameserver.model.entity.event.LastMan;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
    import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
    +import com.l2jfrozen.gameserver.network.L2GameClient;
    import com.l2jfrozen.gameserver.network.SystemMessageId;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
    @@ -32,7 +35,6 @@
    public final class Logout extends L2GameClientPacket
    {
    private static Logger _log = Logger.getLogger(Logout.class.getName());
    -
    @Override
    protected void readImpl()
    {
    @@ -47,12 +49,27 @@
    if (player == null)
    return;

    + if(player.inLASTMAN == true)
    + {
    + player.sendMessage("You cannot Logout while in registered in an Event.");
    + player.sendPacket(ActionFailed.STATIC_PACKET);
    + return;
    + }
    +
    if (player.isInFunEvent() && !player.isGM())
    {
    player.sendMessage("You cannot Logout while in registered in an Event.");
    player.sendPacket(ActionFailed.STATIC_PACKET);
    return;
    }
    +

    if (player.isAway())
    {

    Eliminar las 2 primeras lineas de error sustituyendolas con esta

    Código: [Seleccionar]
     if (p.getKarma() > 0)
     {
     p.sendMessage("You can not register pk");

    las ultimas dos lineas eliminalas si no tenes el evento Arena.