Jump to content

[Share].Valakas Command


Recommended Posts

This post has been done by pankostrelos in greek section.

 

With this command (.valakas) you  get ported to valakas lair!

 

ADD THE FOLLOWING CODE TO: voicedcommandhandlers/Valakas.java

 

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.handler.voicedcommandhandlers;

import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.instancemanager.SiegeManager;
import com.l2jfree.gameserver.instancemanager.ValakasManager;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.model.entity.Siege;
import com.l2jfree.gameserver.model.zone.L2Zone;

/**
* @author Horus
*
*/
public class Valakas implements IVoicedCommandHandler
{
private static final String[]	VOICED_COMMANDS	=
												{ "valakas" };

/* (non-Javadoc)
 * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String)
 */
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String text)
{
	if (command.startsWith("valakas"))
		return valakas(activeChar);
	return false;
}

/* (non-Javadoc)
 * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
 */

private boolean valakas(L2PcInstance activeChar)
{
	Siege siege = SiegeManager.getInstance().getSiege(activeChar);


	if (activeChar.isTransformed())
	{
		activeChar.sendMessage("You can't teleport to valakas while transformed");
		return false;
	}
	//check player is dead or using fake death and has his movement disabled
	if (activeChar.isMovementDisabled() || activeChar.isAlikeDead())
	{
		activeChar.sendMessage("You can't teleport to valakas with fake death nor rooted");
		return false;
	}
	// Check if the player is currently in Siege
	if (siege != null && siege.getIsInProgress())
	{
		activeChar.sendMessage("You are in siege, cannot teleport to Valakas.");
		return false;
	}
	// Check if the player is a Cursed Weapon owner
	if (activeChar.isCursedWeaponEquipped())
	{
		activeChar.sendMessage("You cannot teleport to Valakas! You are currently holding a cursed weapon.");
		return false;
	}
	// Check if the player is in Duel
	if (activeChar.isInDuel())
	{
		activeChar.sendMessage("You cannot teleport to Valakas! You are in a duel!");
		return false;
	}
	//check if the player is in a DimensionalRift
	if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
	{
		activeChar.sendMessage("You cannot teleport to Valakas! You are in the dimensional rift.");
		return false;
	}
	// Check if the player is in an event
	if (activeChar.isInFunEvent())
	{
		activeChar.sendMessage("You cannot teleport to Valakas since you are in an event.");
		return false;
	}
	//check player is in Olympiad
	if (activeChar.isInOlympiadMode() || activeChar.getOlympiadGameId() != -1)
	{
		activeChar.sendMessage("Teleporting to Valakas whilst in Olympiad isn't allowed.");
		return false;
	}
	// Check if player is in observer mode
	if (activeChar.inObserverMode())
	{
		activeChar.sendMessage("You cannot teleport to Valakas in Observer mode!");
		return false;
	}
	//check player has karma/pk/pvp status
	if (activeChar.getKarma() > 0 || activeChar.getPvpFlag() > 0)
	{
		activeChar.sendMessage("Flagged Players & Karma Players cannot use this command.");
		return false;
	}
	//Check if player is immobilized
	if (activeChar.isImmobilized())
	{
		activeChar.sendMessage("Immobilized players cannot use this command.");
		return false;
	}
	if (!(activeChar.getAdena() >= 500000))
		activeChar.sendMessage("You do not hold enough adena to teleport.");
	// check if no one is targeted
	if (activeChar.getTarget() == null)
		ValakasManager.getInstance().Teleport(activeChar);
	return true;
}


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

 

 

 

ADD THE FOLLOWING CODE TO: instancemanager/ValakasManager.java

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.instancemanager;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.l2jfree.Config;
import com.l2jfree.gameserver.ThreadPoolManager;
import com.l2jfree.gameserver.ai.CtrlIntention;
import com.l2jfree.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.serverpackets.SetupGauge;
import com.l2jfree.gameserver.network.serverpackets.SocialAction;

/**
* @author Horus
*
*/
public final class ValakasManager
{
private static final Log				_log	= LogFactory.getLog(ValakasManager.class.getName());
private static ValakasManager				_instance;

public static final ValakasManager getInstance()
{
	if (_instance == null)
	{
		_instance = new ValakasManager();
		_log.info("ValakasManager: initialized.");
	}
	return _instance;
}



/**
 * @param activeChar
 * @param text
 */
public void Teleport(L2PcInstance activeChar)
{
	activeChar.startAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
	activeChar.sendMessage("You will be teleported in " + 120 + " Seconds.");
	activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
	if(activeChar.isSitting())
	{
		activeChar.sendMessage("You cannot be sitting while teleporting to Valakas.");
		return;
	}
	SetupGauge sg = new SetupGauge(SetupGauge.BLUE, 120 * 1000);
	activeChar.sendPacket(sg);
	activeChar.setIsImmobilized(true);
	ThreadPoolManager.getInstance().scheduleGeneral(new PlayerTeleportTask(activeChar), 120 * 1000);
}

/**
 * @param activeChar
 */


class PlayerTeleportTask implements Runnable
{

	private final L2PcInstance	_activeChar;

	PlayerTeleportTask(L2PcInstance activeChar)
	{
		_activeChar = activeChar;
	}

	public void run()
	{
		if (_activeChar == null)
			return;
		if (_activeChar.isAttackingNow() || _activeChar.isCastingNow())
		{
			_activeChar.sendMessage("Cannot teleport if you are Casting or Attacking.");
			return;
		}
		_activeChar.stopAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
		_activeChar.getInventory().reduceAdena("ValakasManager", 500000, _activeChar, null);
		_activeChar.setIsImmobilized(false);
		_activeChar.teleToLocation(2138*** -115436, -1639);
		_activeChar.sendMessage("You have successfully teleported to Valakas.");
_activeChar.sendMessage("horusicarus@gmail.com");
		_log.info("ValakasManager: Player " + _activeChar.getName() + " was sucessfully ported.");

	}
}

 

 

ADD THE FOLLOWING CODE TO: handler/voicedcommandhandler.java

 

registerVoicedCommandHandler(new Valakas());

 

It works on L2jfree

Credits go to Horus for the guide

 

Credits to me for translating

Link to comment
Share on other sites

  • 1 month later...

reshare? xaxa

anyway, if u can make for valakas, could u make and for baium? it would be more useful :P

Just so that you know, that is actually my work, I shared it on RZ and someone just copied over here and claimed it as their own. And yup I can do it, if you aint lazy just read through the code and you'll see that all you have to do is change the coordinates.

 

Original Share was made "Here" .

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock