06-12-2010, 02:30 AM
|
#16 (permalink)
|
|
Membro - Coronel
Registrado em: Dec 2008
Localização: Campo Grande
Posts: 185
Agradecido 1,929 Vezes em 100 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Nome Real: Victor Mendonça
|
Código para L2JServer
Código dos handlers pra L2JServer
/* * 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 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.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...
|
|
|