Jump to content

Custom Pvp Zone ( Freya - H5 ) Up-Dated


Recommended Posts

Hello again !

 

I decided to re-share this code , ( i got many pm's requesting it )

 

So :

 


I want to share here , a mod i used to use on my server !

 

It is a custom PvP Zone That have some nice features to enjoy PvP's !

 

 

This Zone have :

 

1)Auto Nobless every time you die

2)Auto Flag on Enter

3)When you die , you have the oportunity to write .res and automatically you will respawed into the PvP zone on random locations !

 

For Example ,

 

Player2 got killed from player1

 

Then he have 2 options !

 

1st ) Is to press to village , and go to nearest town

2nd) is to write .res and re-spawned ( with auto noblesse ) into pvp zone  in different location each time !

 

 

In order to use .res feature player will need some Gold knight ( You can change this )

 

 

Ok , credits are mine (*NeverMore*)

 

 

How to apply ?

 

1) Create a new voicedcommandhandler with name Res.java and inside put this code :

 

/*
* 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 handlers.voicedcommandhandlers;

import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;


/**
* *NeverMore*
*
*/
public class Res implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "res" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {    
        if (command.equalsIgnoreCase("res"))
        {
              if (!activeChar.isAlikeDead())
              {
                 activeChar.sendMessage("You cannot be ressurected while alive.");
                 return false;
              }
           if(activeChar.isInOlympiadMode())
              {
              activeChar.sendMessage("You cannot use this feature during olympiad.");
             return false;
           }
           if(activeChar.isInJail())
             {
              activeChar.sendMessage("You cannot use this command while you are in Jail.");
             return false;
           }
           if(activeChar.isInDuel())
            {
             activeChar.sendMessage("You cannot use this feature during Duel.");
            return false;
          }
          if(activeChar.isFestivalParticipant())
           {
            activeChar.sendMessage("You cannot use this feature during a Festival.");
           return false;
          }
          if(activeChar.inObserverMode())
           {
            activeChar.sendMessage("You cannot use this feature during Observer Mode.");
           return false;
          }
           if(activeChar.getInventory().getItemByItemId(3483) == null)
           {
              activeChar.sendMessage("You need 500 or more Gold Knights to use the .res");
             return false;
           }   
       	if(activeChar instanceof L2PcInstance && ((L2PcInstance)activeChar).getWorldRegion().containsZone(5555))
       	{
              activeChar.sendMessage("You have been ressurected!");
              activeChar.getInventory().destroyItemByItemId("root", 3483, 500, activeChar, activeChar.getTarget());
              activeChar.doRevive();
              activeChar.broadcastUserInfo();
              activeChar.sendMessage("Good Fight !");     
        }
       	else 
       	{
       		activeChar.sendMessage(".res can only be used in PvP Area");
       	}
        }
       return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }

}

 

2)Now we need to import the vcm , so go to data/scripts/handlers/MasterHandler.java apply this code :

 

@@ -250 +258 @@
import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.Res;
import handlers.voicedcommandhandlers.Wedding;

@@ -555 +570 @@

private static void loadVoicedHandlers()
{	
      +VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Res());
	if (Config.L2JMOD_ALLOW_WEDDING)
		VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());

 

 

3)Create a new zone type with name L2CustomPvP.java and inside put this code :

(+++ java/com/l2jserver/gameserver/model/zone/type/L2CustomPvP.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.l2jserver.gameserver.model.zone.type;

import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.zone.L2SpawnZone;
import com.l2jserver.util.Rnd;


/**
* An Custom PvP Zone
*
* @author  NeverMore
*/
public class L2CustomPvP extends L2SpawnZone
{
//Ramdom Locations configs
    private static int[] _x = {11551, 10999, 10401};
    private static int[] _y = {-24264, -23576, -24030};
    private static int[] _z = {-3644, -3651, -3660 };

public L2CustomPvP(int id)
{
	super(5555);
}

@Override
protected void onEnter(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

       if (character instanceof L2PcInstance)
       {
    	   ((L2PcInstance) character).sendMessage("You enter a PvP Area");
           ((L2PcInstance) character).setPvpFlag(1);	           
       }
}

@Override
protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

	if (character instanceof L2PcInstance)
	{
		((L2PcInstance) character).stopNoblesseBlessing(null);
		((L2PcInstance) character).setPvpFlag(0);
    	((L2PcInstance) character).sendMessage("You exit from a PvP Area");
	}
}

static class BackToPvp implements Runnable
{
	private L2Character _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = character;
	}

        @Override
        public void run()
        {
            int r = Rnd.get(3);
            _activeChar.teleToLocation(_x[r] , _y[r], _z[r]); 
        }
}

@Override
public void onDieInside(L2Character character)
{
       if (character instanceof L2PcInstance)
       {
       }
}

@Override
public void onReviveInside(L2Character character)
{
        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);
        ((L2PcInstance) character).isNoblesseBlessed();
}
}

 

4) Now we should change the Zone Type of the area  ( I use Primeval Isle Warf )

go to : data/zones/peace_zones.xml and aply this code :

 

@@ -834 +847 @@
-	<zone name="primeval_peace1" type="PeaceZone" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- [20_17] -->
-		<node X="10408" Y="-27395" />
-		<node X="12065" Y="-25334" />
-		<node X="12223" Y="-23159" />
-		<node X="10424" Y="-22340" />
-		<node X="9566" Y="-23131" />
-		<node X="9290" Y="-24261" />
-	</zone>
-	<zone name=" primeval_peace2" type="PeaceZone" shape="NPoly" minZ="-4792" maxZ="208"> <!-- [20_17] -->
-		<node X="4850" Y="-4736" />
-		<node X="7294" Y="-4712" />
-		<node X="8529" Y="-820" />
-		<node X="3615" Y="-737" />
-	</zone>
+	<zone name="primeval_peace1" type="CustomPvP" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- [20_17] -->
+		<node X="10408" Y="-27395" />
+		<node X="12065" Y="-25334" />
+		<node X="12223" Y="-23159" />
+		<node X="10424" Y="-22340" />
+		<node X="9566" Y="-23131" />
+		<node X="9290" Y="-24261" />
+	</zone>
+	<zone name=" primeval_peace2" type="CustomPvP" shape="NPoly" minZ="-4792" maxZ="208"> <!-- [20_17] -->
+		<node X="4850" Y="-4736" />
+		<node X="7294" Y="-4712" />
+		<node X="8529" Y="-820" />
+		<node X="3615" Y="-737" />
+	</zone>

 

 

Here is an example , on how to add the coordinates

 

loc 1  x=1 y=2 z=3

loc 2  x=4 y=5 z=6

loc 3  x=7 y=8 z=9

 

you should make it like this

 

 

 

 private static int[] _x = {1, 4, 7};
    private static int[] _y = {2, 5, 8};
    private static int[] _z = {7, 8, 9 };

 


 

UPDATE 1

 

 

I test it on H% and it is not working as it is

 

So Here is the new coded with simple changes to work fine at H5 ! [3rd Step ONLY]

 

/*
* 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.l2jserver.gameserver.model.zone.type;

import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.util.Rnd;


/**
* An Custom PvP Zone
*
* @author  NeverMore
*/
public class L2CustomPvP extends L2RespawnZone
{
//Ramdom Locations configs
    private static int[] _x = {11551, 10999, 10401};
    private static int[] _y = {-24264, -23576, -24030};
    private static int[] _z = {-3644, -3651, -3660 };

public L2CustomPvP(int id)
{
	super(5555);
}

@Override
protected void onEnter(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

       if (character instanceof L2PcInstance)
       {
    	   ((L2PcInstance) character).sendMessage("You enter a PvP Area");
           ((L2PcInstance) character).setPvpFlag(1);	           
       }
}

@Override
protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

	if (character instanceof L2PcInstance)
	{
		((L2PcInstance) character).stopNoblesseBlessing(null);
		((L2PcInstance) character).setPvpFlag(0);
    	((L2PcInstance) character).sendMessage("You exit from a PvP Area");
	}
}

static class BackToPvp implements Runnable
{
	private L2Character _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = character;
	}

        @Override
        public void run()
        {
            int r = Rnd.get(3);
            _activeChar.teleToLocation(_x[r] , _y[r], _z[r]); 
        }
}

@Override
public void onDieInside(L2Character character)
{
       if (character instanceof L2PcInstance)
       {
       }
}

@Override
public void onReviveInside(L2Character character)
{
        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);
        ((L2PcInstance) character).isNoblesseBlessed();
}
}

 


 

UPDATE 2

 

 

Here is a small fix if you want players to stay Flagged 10 seconds after they exit my Custom Pvp Zone

 

Index: trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 308)
+++ trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 309)
@@ -657,13 +657,17 @@
    {
        updatePvPFlag(1);

-       _PvPRegTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PvPFlag(), 1000, 1000);
+       if (_PvPRegTask == null)
+           _PvPRegTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PvPFlag(), 10000, 10000);
    }

    public void stopPvpRegTask()
    {
        if (_PvPRegTask != null)
+       {
            _PvPRegTask.cancel(true);
+           _PvPRegTask = null;
+       }
    }

    public void stopPvPFlag()

 

PS: Dont forget to Start Flag onExit !

Link to comment
Share on other sites

I won't use it but If you tested it and it works then I gratz you.

AND I'll award you if a member test it and say it works because it's the 1st cool share I see for Freya - Hi5

Link to comment
Share on other sites

I won't use it but If you tested it and it works then I gratz you.

AND I'll award you if a member test it and say it works because it's the 1st cool share I see for Freya - Hi5

Works 100 % because i use it ..!

 

But ok , if any1 tested reply with results ;)

Link to comment
Share on other sites

FOR ME WORKS.. !!! Cool Share M8!! Keep It Up!!

Np ! Report me any prob , to fix it ;)

im gonna test this and if it works im gonna use it on my server you should protect this with 100 post or something :D

Done !

 

 

Thanks for good words !

Link to comment
Share on other sites

You just took this code http://l2jfrozen.com/index.php?topic=4869.0

and you removed some parts.Not really smart.And this won't work btw.You get the flag but on kill you got karma

 

also another one is here http://www.-leeching-.net/forum/index.php?topic=11648.0

 

First of all , i dont use IL and i even not have an account on this forum ... ( l2j frozen )

Second,

.Res command can be made this way . . . if you know something more edvance then tell me  ;)

(For Example if i ask some1 make me this command he will make it this way) [ i quess ]

 

And about Gp share is completely different ... if you know java and read my code you will understand what i mean !

I am not a leeacher and everyone here know it ;)

 

Thanks for reply !

Link to comment
Share on other sites

You just took this code http://l2jfrozen.com/index.php?topic=4869.0

and you removed some parts.Not really smart.And this won't work btw.You get the flag but on kill you got karma

 

also another one is here http://www.-leeching-.net/forum/index.php?topic=11648.0

lol i cant believe that nevermore is leacher

i saw his post in L2 Dev help section about this mod

and i am  sure its done by him 100%

 

On topic : nice share it work in freya l2jserver last  rev ?

Link to comment
Share on other sites

lol i cant believe that nevermore is leacher

i saw his post in L2 Dev help section about this mod

and i am  sure its done by him 100%

 

On topic : nice share it work in freya l2jserver last  rev ?

 

;)

 

Yes it should work and for latest rev ;) If you have any prob , post it here to help you !

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...