Secret Experience

Secret Experience (https://secretexperience.net/index.php)
-   [Lineage] Java Mods (https://secretexperience.net/forumdisplay.php?f=636)
-   -   [L2JEmu] Comandos de Join, Leave & Info para TvT & CTF (https://secretexperience.net/showthread.php?t=10330)

KaL 02-07-2009 11:22 PM

Comandos de Join, Leave & Info para TvT & CTF
 
Este Mod habilita os comandos .tvtjoin, .ctfjoin, .tvtleave, .ctfleave, .tvtinfo & .ctfinfo. Feito para plataforma L2jEmu.

Vá na pasta gameserver/handler/voicedcommandhandlers e crie o arquivo TvTCmd.java
Código:

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

import com.l2emu.gameserver.handler.IVoicedCommandHandler;
import com.l2emu.gameserver.instancemanager.ZoneManager;
import com.l2emu.gameserver.model.actor.instance.L2PcInstance;
import com.l2emu.gameserver.model.entity.events.TvT;
import com.l2emu.gameserver.model.zone.L2Zone;
import com.l2emu.gameserver.network.serverpackets.NpcHtmlMessage;

public class TvTCmd implements IVoicedCommandHandler
{
        private static final String[] VOICED_COMMANDS = { "tvtjoin", "tvtleave", "tvtinfo" };

        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
                if (command.startsWith("tvtjoin"))
                {
                        JoinTvT(activeChar);
                }
                else if(command.startsWith("tvtleave"))
                {
                        LeaveTvT(activeChar);
                }

                else if(command.startsWith("tvtinfo"))
                {
                        TvTinfo(activeChar);
                }

                return true;
        }

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

        public boolean JoinTvT (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }
                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

               
                if (!TvT._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (TvT._joining && activeChar._inEventTvT)
                {
                        npcHtmlMessage.setHtml("<html><body>You are already registered.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isCursedWeaponEquipped())
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are holding a Cursed Weapon.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isInOlympiadMode())
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Olympiad.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isInJail() || activeChar.isInsideZone(L2Zone.FLAG_JAIL)) //check if player is in jail
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Jail.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (activeChar.getLevel() < TvT._minlvl)
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you level is too low.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (activeChar.getKarma() > 0)
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you have Karma.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (TvT._teleport || TvT._started)
                {
                        npcHtmlMessage.setHtml("<html><body>TvT Event registration period is over.<br>You can't register now.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        npcHtmlMessage.setHtml("<html><body>Your participation in the TvT event has been approved.<br>Prepare to kill your enemies.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        TvT.addPlayer(activeChar,"");
                        return false;
                }
        }

        public boolean LeaveTvT (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }

                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

                if (!TvT._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ((TvT._teleport || TvT._started) && activeChar._inEventTvT)
                {
                        npcHtmlMessage.setHtml("<html><body>You can not leave now because TvT event has started.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (TvT._joining && !activeChar._inEventTvT)
                {
                        npcHtmlMessage.setHtml("<html><body>You aren't registered in the TvT Event.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        npcHtmlMessage.setHtml("<html><body>Your participation in the TvT event has been removed.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        TvT.removePlayer(activeChar);
                        return true;
                }
        }
        public boolean TvTinfo (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }

                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

                if (!TvT._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (TvT._teleport || TvT._started)
                {
                        npcHtmlMessage.setHtml("<html><body>I can't provide you this info.<br>Command available only in joining period.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        if (TvT._playersShuffle.size() == 1)
                        {
                                npcHtmlMessage.setHtml("<html><body>There is " + TvT._playersShuffle.size() + " player participating in this event.</body></html>");
                                activeChar.sendPacket( npcHtmlMessage );
                        }
                        else
                        {
                                npcHtmlMessage.setHtml("<html><body>There are " + TvT._playersShuffle.size() + " players participating in this event.</body></html>");
                                activeChar.sendPacket( npcHtmlMessage );
                        }
                        return true;
                }
        }
}

Ainda nesta pasta, crie o arquivo CTFCmd.java

Código:

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

import com.l2emu.gameserver.handler.IVoicedCommandHandler;
import com.l2emu.gameserver.instancemanager.ZoneManager;
import com.l2emu.gameserver.model.actor.instance.L2PcInstance;
import com.l2emu.gameserver.model.entity.events.CTF;
import com.l2emu.gameserver.model.zone.L2Zone;
import com.l2emu.gameserver.network.serverpackets.NpcHtmlMessage;

public class CTFCmd implements IVoicedCommandHandler
{
        private static final String[] VOICED_COMMANDS = { "ctfjoin", "ctfleave", "ctfinfo" };

        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
                if (command.startsWith("ctfjoin"))
                {
                        JoinCTF(activeChar);
                }
                else if(command.startsWith("ctfleave"))
                {
                        LeaveCTF(activeChar);
                }

                else if(command.startsWith("ctfinfo"))
                {
                        CTFinfo(activeChar);
                }

                return true;
        }

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

        public boolean JoinCTF (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }
                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

               
                if (!CTF._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no CTF Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (CTF._joining && activeChar._inEventCTF)
                {
                        npcHtmlMessage.setHtml("<html><body>You are already registered.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isCursedWeaponEquipped())
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are holding a Cursed Weapon.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isInOlympiadMode())
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Olympiad.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ( activeChar.isInJail() || activeChar.isInsideZone(L2Zone.FLAG_JAIL)) //check if player is in jail
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Jail.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (activeChar.getLevel() < CTF._minlvl)
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you level is too low.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (activeChar.getKarma() > 0)
                {
                        npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you have Karma.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (CTF._teleport || CTF._started)
                {
                        npcHtmlMessage.setHtml("<html><body>CTF Event registration period is over.<br>You can't register now.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        npcHtmlMessage.setHtml("<html><body>Your participation in the CTF event has been approved.<br>Prepare to kill your enemies.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        CTF.addPlayer(activeChar,"");
                        return false;
                }
        }

        public boolean LeaveCTF (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }

                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

                if (!CTF._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no CTF Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if ((CTF._teleport || CTF._started) && activeChar._inEventCTF)
                {
                        npcHtmlMessage.setHtml("<html><body>You can not leave now because CTF event has started.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (CTF._joining && !activeChar._inEventCTF)
                {
                        npcHtmlMessage.setHtml("<html><body>You aren't registered in the CTF Event.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        npcHtmlMessage.setHtml("<html><body>Your participation in the CTF event has been removed.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        CTF.removePlayer(activeChar);
                        return true;
                }
        }
        public boolean CTFinfo (L2PcInstance activeChar)
        {
                if ( activeChar == null)
                {
                        return false;
                }

                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );

                if (!CTF._joining)
                {
                        npcHtmlMessage.setHtml("<html><body>There is no CTF Event in progress.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else if (CTF._teleport || CTF._started)
                {
                        npcHtmlMessage.setHtml("<html><body>I can't provide you this info.<br>Command available only in joining period.</body></html>");
                        activeChar.sendPacket( npcHtmlMessage );
                        return false;
                }
                else
                {
                        if (CTF._playersShuffle.size() == 1)
                        {
                                npcHtmlMessage.setHtml("<html><body>There is " + CTF._playersShuffle.size() + " player participating in this event.</body></html>");
                                activeChar.sendPacket( npcHtmlMessage );
                        }
                        else
                        {
                                npcHtmlMessage.setHtml("<html><body>There are " + CTF._playersShuffle.size() + " players participating in this event.</body></html>");
                                activeChar.sendPacket( npcHtmlMessage );
                        }
                        return true;
                }
        }
}

Creditos : Cobra pela transição

DanielF 06-07-2009 09:14 PM

Meu L2Emu tem o seguinte codigo no VoicedCommandHandler.java, como eu add o novo voiced?
Código PHP:

/*
 * 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.l2emuproject.gameserver.handler;

import javolution.util.FastMap;

import net.l2emuproject.Config;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * This class ...
 *
 * @version $Revision: 1.1.4.5 $ $Date: 2005/03/27 15:30:09 $
 */
public class VoicedCommandHandler
{
    private final static 
Log                        _log    LogFactory.getLog(ItemHandler.class.getName());

    private static 
VoicedCommandHandler                _instance;

    private 
FastMap<StringIVoicedCommandHandler>    _datatable;

    public static 
VoicedCommandHandler getInstance()
    {
        if (
_instance == null)
            
_instance = new VoicedCommandHandler();
        return 
_instance;
    }

    private 
VoicedCommandHandler()
    {
        
_datatable = new FastMap<StringIVoicedCommandHandler>();
        
//_log.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
    
}

    public 
void registerVoicedCommandHandler(IVoicedCommandHandler handler)
    {
        
String[] ids handler.getVoicedCommandList();
        for (
String element ids)
        {
            if (
_log.isDebugEnabled() || Config.DEBUG)
                
_log.debug("Adding handler for command " element);
            
_datatable.put(elementhandler);
        }
    }

    public 
IVoicedCommandHandler getVoicedCommandHandler(String voicedCommand)
    {
        
String command voicedCommand;
        if (
voicedCommand.indexOf(" ") != -1)
            
command voicedCommand.substring(0voicedCommand.indexOf(" "));
        if (
_log.isDebugEnabled() || Config.DEBUG)
            
_log.debug("getting handler for command: " command " -> " + (_datatable.get(command) != null));
        return 
_datatable.get(command);
    }

    public 
int size()
    {
        return 
_datatable.size();
    }



KaL 06-07-2009 10:41 PM

Perdão, foi um erro meu, adicionei coisa a mais aí! xD
Teste apenas com esta source, sem o VoicedCommandHandler.java modificado...veja se surtiu efeito nos comandos e dê um feed back...

felipe360 07-07-2009 01:12 AM

Tem como modificar para l2jserver?

Boots 07-07-2009 08:45 PM

Bom meu amigo nao so o criador mais vo responde mesmo assim ate da pra por em
l2j so que seria um bom trabalho e uma bela dor de cabeça por isso é plataforma L2jEmu. :D

VslDream 07-07-2009 11:51 PM

Da pra por em L2jServer sim. Vai dar mais trabalho que L2jEmu?
Com certeza... mas voce vai ter um PACK muito melhor.
Pois veja bem, EMU, usa base L2jFree, que usa base L2JServer.

Emu é um bosta, o cara so faz codigo pesado. S
Se tu tem a manha de colocar adicionar os CODIGOS no java, vai JSERVER.
Muito melhor pra tu!

Vlws!

WiLLNakamura 08-07-2009 12:05 PM

Concordo com voce Vsl.

L2JServer é o melhor server, e L2JFree por usar a sua base também é muito bom.

Reparei que a maioria das pessoas que falam mal dos packs L2JFree é porque nao tem o minimo conhecimento de java.

Eu já uso esses comandos em meu server L2JFREE a muito tempo.

Recomendo inserir manualmente isso no core, para evitar problemas.

Ate +

felipe360 08-07-2009 07:18 PM

O problema é que não sei mecher em java. To apanhando para add esses comandos.

paytaly 08-07-2009 07:27 PM

@felipe360, Java não se aprende com um Tutorial.
Procure no Google apostilas de Java ou uma faculdade.

felipe360 08-07-2009 07:32 PM

Sim, tenho um amigo que é formado em java, vo pedir umas dicas para ele.

----------

A e mais uma coisa, "Nada é impossivel".

VslDream 08-07-2009 08:00 PM

Citação:

A e mais uma coisa, "Nada é impossivel".
Exatamente!
O paytaly nao disse que é impossivel, so disse que nao vai aprender JAVA em TUTORIAL. E realmente nao vai...

Procure ALGUEM mesmo que possa lhe dar aulas, uma faculdade, ou LIVROS, e APOSTILAS.

Vlws!

WiLLNakamura 08-07-2009 08:13 PM

Teoricamente para se aprender java como paytaly e vsl disseram é nescessario muito estudo (faculdade e tutoriais).

Mas existe outro modo, que é aprender mechendo, as vezes funciona dependendo da pessoa, tipo de pessoa que gosta de testar tudo e que nao tem preguica.

Boa sorte.

Mazokista 05-07-2010 10:16 PM

Esse Mod e Compativel Para Pegar No Projeto ********* ???

magno15 13-07-2010 11:12 AM

2 Perguntas..
1 o Mazokista ja perguntou.. quero saber a responta! :P

Outra.. como eu mudo o comando para..
.tvton = JOIN
.tvtoff = LEAVE

???


Obg...

Guma 13-07-2010 11:49 AM

serve pra qualquer pack basta adaptar.

voce muda os comando q estao em vermelho

Citação:

public class TvTCmd implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "tvtjoin", "tvtleave", "tvtinfo" };

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.startsWith("tvtjoin"))
{
JoinTvT(activeChar);
}
else if(command.startsWith("tvtleave"))
{
LeaveTvT(activeChar);
}

else if(command.startsWith("tvtinfo"))
{
TvTinfo(activeChar);
}

return true;
}


mend3 06-12-2010 02:30 AM

Código para L2JServer
 
Código dos handlers pra L2JServer

Código PHP:

/*
 * 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.entity.TvT;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;

public class 
TvTCmd implements IVoicedCommandHandler {

    private static final 
String[] VOICED_COMMANDS = {"tvtjoin""tvtleave""tvtinfo"};

    public 
boolean useVoicedCommand(String commandL2PcInstance activeCharString target) {
        if (
command.startsWith("tvtjoin")) {
            
JoinTvT(activeChar);
        } else if (
command.startsWith("tvtleave")) {
            
LeaveTvT(activeChar);
        } else if (
command.startsWith("tvtinfo")) {
            
TvTinfo(activeChar);
        }

        return 
true;
    }

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

    public 
boolean JoinTvT(L2PcInstance activeChar) {
        if (
activeChar == null) {
            return 
false;
        }
        
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);


        if (!
TvT._joining) {
            
npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
TvT._joining && activeChar._inEventTvT) {
            
npcHtmlMessage.setHtml("<html><body>You are already registered.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isCursedWeaponEquiped()) {
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are holding a Cursed Weapon.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isInOlympiadMode()) {
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Olympiad.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isInJail()) { //check if player is in jail
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you are in Jail.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.getLevel() < TvT._minlvl) {
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you level is too low.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.getLevel() < TvT._maxlvl) {
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you level is too high.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.getKarma() > 0) {
            
npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event<br>Because you have Karma.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
TvT._teleport || TvT._started) {
            
npcHtmlMessage.setHtml("<html><body>TvT Event registration period is over.<br>You can't register now.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isHero()) {
            
npcHtmlMessage.setHtml("<html><body>Hero players can't participate to the event.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isInFunEvent()) {
            
npcHtmlMessage.setHtml("<html><body>You're already in a envent</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (!
activeChar.isInsidePeaceZone(activeChar)) {
            
npcHtmlMessage.setHtml("<html><body>You must be in peace zone to register at the event</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
activeChar.isInStoreMode()) {
            
npcHtmlMessage.setHtml("<html><body>You can't register while in a private store</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else {
            
npcHtmlMessage.setHtml("<html><body>Your participation in the TvT event has been approved.<br>Prepare to kill your enemies.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            
TvT.addPlayer(activeChar"");
            return 
false;
        }
    }

    public 
boolean LeaveTvT(L2PcInstance activeChar) {
        if (
activeChar == null) {
            return 
false;
        }

        
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

        if (!
TvT._joining) {
            
npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if ((
TvT._teleport || TvT._started) && activeChar._inEventTvT) {
            
npcHtmlMessage.setHtml("<html><body>You can not leave now because TvT event has started.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
TvT._joining && !activeChar._inEventTvT) {
            
npcHtmlMessage.setHtml("<html><body>You aren't registered in the TvT Event.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else {
            
npcHtmlMessage.setHtml("<html><body>Your participation in the TvT event has been removed.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            
TvT.removePlayer(activeChar);
            return 
true;
        }
    }

    public 
boolean TvTinfo(L2PcInstance activeChar) {
        if (
activeChar == null) {
            return 
false;
        }

        
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

        if (!
TvT._joining) {
            
npcHtmlMessage.setHtml("<html><body>There is no TvT Event in progress.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else if (
TvT._teleport || TvT._started) {
            
npcHtmlMessage.setHtml("<html><body>I can't provide you this info.<br>Command available only in joining period.</body></html>");
            
activeChar.sendPacket(npcHtmlMessage);
            return 
false;
        } else {
            if (
TvT._playersShuffle.size() == 1) {
                
npcHtmlMessage.setHtml("<html><body>There is " TvT._playersShuffle.size() + " player participating in this event.</body></html>");
                
activeChar.sendPacket(npcHtmlMessage);
            } else {
                
npcHtmlMessage.setHtml("<html><body>There are " TvT._playersShuffle.size() + " players participating in this event.</body></html>");
                
activeChar.sendPacket(npcHtmlMessage);
            }
            return 
true;
        }
    }


Para quem tem os packages diferentes, basta alterar os imports.

Enjoy...

Donator 06-01-2012 03:52 PM

Código:

ahi faltan varias cosas

en el dp
vas  a \gameserver\data\scripts\handlers\masterhandlers y

  import handlers.voicedcommandhandlers.ChatAdmin;
+import handlers.voicedcommandhandlers.CTFCmd;
+import handlers.voicedcommandhandlers.TvTCmd;
  import handlers.voicedcommandhandlers.Debug;

ahora en el core
java/com/l2jserver/config.java

          public static boolean TVT_ALLOW_VOICED_COMMAND;
        +public static boolean TVT_ALLOW_REGISTER_VOICED_COMMAND;
          public static String CTF_EVEN_TEAMS;

          public static long CTF_REVIVE_DELAY;
          public static boolean CTF_BASE_TELEPORT_FIRST;
        +public static boolean CTF_ALLOW_REGISTER_VOICED_COMMAND;




+TVT_ALLOW_REGISTER_VOICED_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("TVTAllowRegisterVoicedCommand", "false"));

 TVT_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();
 TVT_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();

 


CTF_REVIVE_DELAY = 1000; //can't be set less then 1 second       
+CTF_ALLOW_REGISTER_VOICED_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("CTFAllowRegisterVoicedCommand", "false"));
                                       
 BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));




ahora se van a l2jmods.properties

# PvP Count [Arena and TvT]
TvTArenaKillEnable = True

+#Allow Voiced .jointvt / .leavetvt commands / .infotvt
+TVTAllowRegisterVoicedCommand = True

# ---------------------------------------
# Section: PvP Nick Color Change System by Level


# If True, You must set-up in CTF admin panel
CTFTeleportToBaseFirst = True
+#Allow Voiced .ctfjoin / .ctfleave / .ctfinfo commands
+CTFAllowRegisterVoicedCommand = True

# ---------------------------------------------------------------------------

Bueno este deben aplicarlo manualmente
ademas si te salta error en la consola cuando cargan los script es por que el TvTcmd o el CTFcmd no son compatibles con tu revision o cronica pues hay veces en que los nombres de los archivos o las rutas de una revision o cronica a otra cambian, por lo tanto las importaciones estan mal debes revisar eso y para simplificar el problema borra la importacion que te esta dando error en masterhandlers :spinny: , por cierto esto es para l2jserver pero tmb se puede adaptar para l2mu solo cambien las importaciones nada mas.


Horários baseados na GMT -3. Agora são 01:07 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.