Jump to content

Recommended Posts

Posted

If you don't know how to compile just don't replay  :D or read the guide of A-Style.

 

This are for l2emu also you can change the imports for another pack.  ;)

 

I only modify the code from l2jfree to l2emu...!!

 

The command for Tvt is .join .leave  Some htlm error's already fixed ... player's in jail ...player's in Olympiad etc..they have some error's wen i compile and fixed !!

 

 

There You go;

 

TVT

/*
* 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 = { "join", "leave", "tvtinfo" };

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	if (command.startsWith("join"))
	{
		JoinTvT(activeChar);
	}
	else if(command.startsWith("leave"))
	{
		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;
	}
}
}

 

CTF

 

/*
* 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;
	}
}
}

 

 

This Code made at l2jfree.

 

//done

 

Edit: Link http://www.4shared.com/file/79609345/73b6edfa/Voice_Command_tvtjoin_ctfjoin.html Njoy!

 

 

//End

Posted

Very Well ~Cobra~ but as u say

this made to l2jfree..

u made it or the l2jfree?

Ofc i made it by self ..you can use it on l2emu just change the imports :) Btw try it on l2j only the tvt command bcauz l2j don't have ctf.

 

Just is more easy to make java thinks at l2jfree and ofc at l2j ..l2emu is a little difficult .... :)

Posted

Ofc i made it by self ..you can use it on l2emu just change the imports :) Btw try it on l2j only the tvt command bcauz l2j don't have ctf.

 

Just is more easy to make java thinks at l2jfree and ofc at l2j ..l2emu is a little difficult .... :)

 

yeap! but are 1,2 ctf enginers! so ...he  must apply the patch!

 

l2jfree/l2emu use a FBIAgend Events Enginers with some fixes!

Posted

 

This Code made at l2jfree.

 

 

r u sure u made it yourself?

 

i see the same thing here http://www.l2jfree.com/index.php?topic=4790.msg25524#msg25524

 

good job anyway.

 

And yes i mode it ..lemme tell you something you find somewhere a ready tool ,java code,npc...???

 

I mode it i compile a 3 pack's to see if this work and then i post it.

 

//epic fail ;) 

Posted

Eh....?

 

And btw the patch included in the link i sent is pretty much the same.

 

Anyway i don't want to start a flame or sth, so i just stop.

 

 

 

Ofc i made it by self .... lol ....I take the base code and i modify them ....! Example ..xD..if you take a l2jfree pack and Make a pre pack...what

 

that called?

 

Anyway your opinion...:)

 

 

Posted

Ofc i made it by self .... lol ....I take the base code and i modify them ....! Example ..xD..if you take a l2jfree pack and Make a pre pack...what

 

that called?

 

Anyway your opinion...:)

 

 

if you modify this codes...

so the codes isn't you...

So you must tell us why you modifed they have any error or smt like this?

why u modified...

Fix The 1st post!

Posted

if you modify this codes...

so the codes isn't you...

So you must tell us why you modifed they have any error or smt like this?

why u modified...

Fix The 1st post!

@strike:Yes for my pack's they have some error's ....check the first post.

 

Have some1  try it....?

 

p.s:I hate wen ppl are off topic .... if you have problem with post you can use >>pm<< and solve it...no reason to spam the board. :)

Posted

@strike:Yes for my pack's they have some error's ....check the first post.

 

Have some1 try it....?

 

p.s:I hate wen ppl are off topic .... if you have problem with post you can use >>pm<< and solve it...no reason to spam the board. :)

when u compile with l2j free post i get no errors..

and the codes work perfectly 100%

as you say me u use L2J Emu so if you make it for l2j emu you must fix the 1st post

and edit your title...

-Strike

Posted

as you say me u use L2J Emu so if you make it for l2j emu you must fix the 1st post

and edit your title...

-Strike

 

Yeap i'm using emu pack.

 

First post updated ...!! My Tittle is fine :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...