|
Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo. Caso seja registrado, efetue login. Esqueceu sua senha? Clique aqui Recomendamos o uso do Mozilla Firefox para uma melhor visualização. |
|
| Início | Postados Hoje | Marcar Fóruns Como Lidos | Álbums | Banidos | SE Team | Medalhas |
|
|||||||
| Registrar | Loteria VIP | Staff SE | Regras do fórum | Membros | Arcade | Pesquisar | Postados Hoje | Marcar Fóruns Como Lidos | Experience |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
![]() |
|
|
Ferramentas do Tópico | Modos de Exibição |
|
|
|
|
#1 |
|
Amigo SE
![]() Registrado em: Oct 2009
Posts: 906
Agradeceu: 256
Agradecido 810 Vezes em 341 Posts
|
Esse código é bem interessante.
O que ele faz? Com uma quantia de um item você consegue se teleportar para o lado do player que quiser. É possível o player escolher para que ninguém vá até ele. Para teleportar ao player: .goto <playername> Para bloquear o teleport: .blockgoto Testado em Gracia PT2, mas com poucas modificações funcionará em interlude também. Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
com.l2jfree.gameserver.handler.voicedcommandhandlers.GoToPlayer.java Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
/*
* 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.l2jfree.gameserver.handler.voicedcommandhandlers;
import com.l2jfree.Config;
import java.util.StringTokenizer;
import com.l2jfree.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jfree.gameserver.GameTimeController;
import com.l2jfree.gameserver.SevenSigns;
import com.l2jfree.gameserver.ThreadPoolManager;
import com.l2jfree.gameserver.ai.CtrlIntention;
import com.l2jfree.gameserver.datatables.SkillTable;
import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.instancemanager.CoupleManager;
import com.l2jfree.gameserver.instancemanager.DimensionalRiftManager;
import com.l2jfree.gameserver.instancemanager.SiegeManager;
import com.l2jfree.gameserver.model.L2Character;
import com.l2jfree.gameserver.model.L2FriendList;
import com.l2jfree.gameserver.model.L2Skill;
import com.l2jfree.gameserver.model.L2World;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.model.entity.Siege;
import com.l2jfree.gameserver.model.zone.L2Zone;
import com.l2jfree.gameserver.model.restriction.AvailableRestriction;
import com.l2jfree.gameserver.model.restriction.ObjectRestrictions;
import com.l2jfree.gameserver.network.SystemMessageId;
import com.l2jfree.gameserver.network.serverpackets.ConfirmDlg;
import com.l2jfree.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jfree.gameserver.network.serverpackets.SetupGauge;
import com.l2jfree.gameserver.network.serverpackets.SystemMessage;
import com.l2jfree.gameserver.util.Broadcast;
/**
* @author Rizel
*
*/
public class GoToPlayer implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{ "goto", "blockgoto" };
/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String)
*/
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String name)
{
if (command.startsWith("goto"))
{
return playerTeleport(activeChar, name);
}
if (command.startsWith("blockgoto"))
{
if ( activeChar._blockgoto == true )
{
activeChar._blockgoto = false;
activeChar.sendMessage("Players are now allowed to teleport to you!");
}
if ( activeChar._blockgoto == false )
{
activeChar._blockgoto = true;
activeChar.sendMessage("Players are now not allowed to teleport to you!");
}
return true;
}
return false;
}
public boolean playerTeleport(L2PcInstance activeChar, String name)
{
int teleportItem = 57;
int teleportCost = 1000;
if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || activeChar.isAlikeDead())
return false;
Siege siege = SiegeManager.getInstance().getSiege(activeChar);
// Check to see if the player is in olympiad.
if (activeChar.isInOlympiadMode())
{
activeChar.sendMessage("You are in Olympiad!");
return false;
}
// Check to see if the player is in observer mode
else if (activeChar.inObserverMode())
{
activeChar.sendMessage("You are in observer mode.");
return false;
}
// Check to see if the player is in an event
else if (activeChar.isInFunEvent())
{
activeChar.sendMessage("You are in event now.");
return false;
}
// Check to see if the player is in a festival.
else if (activeChar.isFestivalParticipant())
{
activeChar.sendMessage("You can't escape from a festival.");
return false;
}
// Check to see if the player is in dimensional rift.
else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
{
activeChar.sendMessage("You are in the dimensional rift.");
return false;
}
// Check to see if player is in jail
else if (activeChar.isInJail() || activeChar.isInsideZone(L2Zone.FLAG_JAIL))
{
activeChar.sendMessage("You can't escape from jail.");
return false;
}
// Check if player is in Siege
else if (siege != null && siege.getIsInProgress())
{
activeChar.sendMessage("You are in siege, you can't go to your partner.");
return false;
}
// Check if player is in Duel
else if (activeChar.isInDuel())
{
activeChar.sendMessage("You are in a duel!");
return false;
}
// Check if player is a Cursed Weapon owner
else if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendMessage("You are currently holding a cursed weapon.");
return false;
}
// Check if player is in a Monster Derby Track
else if (activeChar.isInsideZone(L2Zone.FLAG_NOESCAPE))
{
activeChar.sendMessage("You cannot escape from here.");
return false;
}
L2PcInstance targetplayer = L2World.getInstance().getPlayer(name);
if (targetplayer._blockgoto == true)
{
activeChar.sendMessage("Your target blocked the teleport to him/her.");
return false;
}
if (targetplayer.isGM())
{
activeChar.sendMessage("You can't teleport to GM.");
return false;
}
if (targetplayer != null)
{
siege = SiegeManager.getInstance().getSiege(targetplayer);
}
else
{
activeChar.sendMessage("Your target is not online.");
return false;
}
// Check to see if the player is in a instance.
if (activeChar.getInstanceId() != targetplayer.getInstanceId())
{
activeChar.sendMessage("Your target is in another World!");
return false;
}
else if (targetplayer.isInJail() || targetplayer.isInsideZone(L2Zone.FLAG_JAIL))
{
activeChar.sendMessage("Your target is in jail.");
return false;
}
else if (targetplayer.isInOlympiadMode())
{
activeChar.sendMessage("Your target is in Olympiad now.");
return false;
}
else if (targetplayer.inObserverMode())
{
activeChar.sendMessage("Your target is in observer mode.");
return false;
}
else if (targetplayer.isInDuel())
{
activeChar.sendMessage("Your target is in a duel.");
return false;
}
else if (targetplayer.isInFunEvent())
{
activeChar.sendMessage("Your target is in an event.");
return false;
}
else if (DimensionalRiftManager.getInstance().checkIfInRiftZone(targetplayer.getX(), targetplayer.getY(), targetplayer.getZ(), false))
{
activeChar.sendMessage("Your target is in dimensional rift.");
return false;
}
else if (targetplayer.isFestivalParticipant())
{
activeChar.sendMessage("Your target is in a festival.");
return false;
}
else if (siege != null && siege.getIsInProgress())
{
if (targetplayer.getAppearance().getSex())
activeChar.sendMessage("Your target is in siege, you can't go to her.");
else
activeChar.sendMessage("Your target is in siege, you can't go to him.");
return false;
}
else if (targetplayer.isCursedWeaponEquipped())
{
activeChar.sendMessage("Your target is currently holding a cursed weapon.");
return false;
}
else if (targetplayer.isInsideZone(L2Zone.FLAG_NOESCAPE))
{
activeChar.sendMessage("Your target is in a unsuitable area for teleporting.");
return false;
}
else if (targetplayer.isIn7sDungeon() && !activeChar.isIn7sDungeon())
{
int playerCabal = SevenSigns.getInstance().getPlayerCabal(activeChar);
boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod();
int compWinner = SevenSigns.getInstance().getCabalHighestScore();
if (isSealValidationPeriod)
{
if (playerCabal != compWinner)
{
activeChar.sendMessage("Your target is in a Seven Signs Dungeon and you are not in the winner Cabal!");
return false;
}
}
else
{
if (playerCabal == SevenSigns.CABAL_NULL)
{
activeChar.sendMessage("Your target is in a Seven Signs Dungeon and you are not registered!");
return false;
}
}
}
int teleportTimer = 10 * 1000;
if (!activeChar.destroyItemByItemId("", teleportItem, teleportCost, activeChar, true))
{
activeChar.sendMessage("You don't have enough item to teleport.");
return false;
}
activeChar.sendMessage("After " + teleportTimer / 1000 + " sec. you will be teleported to " + name +".");
targetplayer.sendMessage("Player " + activeChar + "teleporting to you.");
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
// SoE Animation section
activeChar.setTarget(activeChar);
activeChar.disableAllSkills();
MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0);
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/*900*/);
SetupGauge sg = new SetupGauge(0, teleportTimer);
activeChar.sendPacket(sg);
// End SoE Animation section
EscapeFinalizer ef = new EscapeFinalizer(activeChar, targetplayer.getX(), targetplayer.getY(), targetplayer.getZ(), targetplayer.isIn7sDungeon());
// Continue execution later
activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer));
activeChar.forceIsCasting(GameTimeController.getGameTicks() + teleportTimer / GameTimeController.MILLIS_IN_TICK);
return true;
}
private static class EscapeFinalizer implements Runnable
{
private L2PcInstance _activeChar;
private int _partnerx;
private int _partnery;
private int _partnerz;
private boolean _to7sDungeon;
EscapeFinalizer(L2PcInstance activeChar, int x, int y, int z, boolean to7sDungeon)
{
_activeChar = activeChar;
_partnerx = x;
_partnery = y;
_partnerz = z;
_to7sDungeon = to7sDungeon;
}
public void run()
{
if (_activeChar.isDead())
return;
_activeChar.setIsIn7sDungeon(_to7sDungeon);
_activeChar.enableAllSkills();
_activeChar.setIsCastingNow(false);
try
{
_activeChar.teleToLocation(_partnerx, _partnery, _partnerz);
}
catch (Exception e)
{
_log.error(e.getMessage(), e);
}
}
}
/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
*/
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
com.l2jfree.gameserver.model.actor.instance.L2PcInstance.java Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
public boolean _inEventTvT = false; public boolean _voteEvent = false; + public boolean _blockgoto = false; Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
com.l2jfree.gameserver.handler.VoicedCommandHandler.java Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
registerVoicedCommandHandler(new Banking()); + registerVoicedCommandHandler(new GoToPlayer()); |
|
|
| Os Seguintes 2 Usuários disseram Obrigado(a) para out por gostarem deste post : |
l2blackice (03-02-2011), ShadowBR (29-08-2015)
|
| Links Patrocinados |
|
|
#2 |
|
Membro - Veterano
![]() Registrado em: Oct 2010
Posts: 413
Agradeceu: 169
Agradecido 113 Vezes em 69 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
![]()
|
Show, se alguém conseguir adaptar pro interlude vai ser muito bom!
|
|
|
|
|
|
#3 |
|
Banido
![]() Registrado em: Nov 2009
Localização: Fortaleza-ce
Posts: 325
Agradeceu: 125
Agradecido 203 Vezes em 82 Posts
Nome Real: Allan Alcântara de Alencar
|
esse mod ta estilo wedding. uaheuahua . mas gostei . vou usalo no meu server . :]]'
|
|
|
|
|
|
#4 | ||||||||||||||
|
Membro - Recruta
![]() Registrado em: Sep 2009
Posts: 3
Agradeceu: 15
Agradecido 0 Vezes em 0 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
|
alguém que entenda bem de mod pode adaptar para l2jfrozen?
|
||||||||||||||
|
|
|
||||||||||||||