Jump to content

Recommended Posts

Posted

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 !

Posted

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 ;)

Posted

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 !

Posted

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 !

Posted

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 ?

Posted

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 !

 

 

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.




  • Posts

    • So few things for this guy:   He asked me to implement a code like EXP, SP, DROP runes in his server that did not work and he paid 27 Euro via Revolut.  He has no idea what compile, source is and he work with ubuntu.  I entered to his PC and using eclipse i add the code and compile as usually, i ask him to replace the jar with the new jar. He did not know how so i did it my self. Later on the ubuntu which im not familiar with could not continue and did not throw any error. I did not know what was happening until i asked Nightwolf who is experienced with Ubuntu and told me probably some error and can't continue. I was surprized since i only added few lines not edit or changed anything so i knew that the Login, Gameserver from source had mismatch with the compiled one. Later on i fix an error he had in raidboss_spawnlist where Long value tried to store inside Int value and explained him:   https://postimg.cc/F1zxMfDW   later on i explained him that source and compiled that he had had many issues and it was not my problem and he said that my code destroyed all his compiled.    In this point i ask @flatronnto post source or compile with my code inside to check the code i made and how he claim it destroyed his source. If he post then all can see what i added and it did not affect the source in an way other than edit the addExperience method - drop method and L2ItemInstance class. If he deny then all his trash talk is fake.   Then i tried contact him to resolve the issue even tho is not my problem, he paid for the code, i did the code, i was done but he ignored me:   https://postimg.cc/ts4RkjXt   I stopped after he claimed i destroyed intentionally his server, that i enter to other's PC to hack / destroy their compiles and when he said he will false advertise my server.    If @Nightw0lf can post he can also verify this guy is mentally ill not only he don't know compile, server, source, java differences but he also claim fake things that any other person with much money and good knowledge and patience could sue him online. He can't even open a proper report topic, he post in L2 OFF section.    In addition this guy offenses rudeness and treats is on another level, we had appointment at 18:00 GR time i was waiting for him 25 min and then i left PC for a bit, he showed up after 30 minutes and he said you're not here ill false advertisent you e.t.c.    https://postimg.cc/pmKNKcjV   He is mentally unstable and nobody should trade with this person. @Celestine Anyone can request LOG from my discord to see all conversation if he want. I have nothing to hide i worked for the money he paid and i did my job perfectly. I have 4-5 clients a week in last year and nobody had issues. Read the answer i just posted and you see who is right and who is wrong.
    • dsgl2 Pm me on discord i will try to help you to talk with winter , but again deal only with him or they will scam you 
    • I have what you're looking for already made, if you want, contact me. Greetings.
    • What webhosting are you using? You'll need to talk with administrators of the webhosting to open outgoing connections to port 1433, maybe they won't open it for you, instead, you should get a webhosting for mu online since they always have 1433 port open for outgoing connections. Also, make sure you have your 1433 TCP port open for incoming connections, for security, I suggest you exclusively add the cPanel IP Address to connect to your port 1433 in your firewall, so no one else can try to connect to your database. Let me know if you have any questions, happy to help.
  • Topics

×
×
  • 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