Jump to content

[Share]Auto Flag at PvP Zones


Recommended Posts

Hello , it's my first share at this forum and i hope u will like it . It's not tested yet (if u test it please leave a reply) . With this code when someone is teleporting at pvp zone then he's autoflagged .

 

L2Characters.java

		/** Zone system */
      +public static final byte ZONE_FLAG_PVP = 0;
public static final byte ZONE_PVP = 0;

find

public final boolean isInsideZone(final byte zone)
{
	return zone == ZONE_PVP ? _zones[ZONE_PVP] > 0 && _zones[ZONE_PEACE] == 0 : _zones[zone] > 0;
}

make it

public final boolean isInsideZone(final byte zone)
{
	return zone == ZONE_PVP ? _zones[ZONE_PVP] > 0 && ZONE_FLAG_PVP ? _zones[ZONE_FLAG_PVP] > 0 && _zones[ZONE_PEACE] == 0 : _zones[zone] > 0;
}

 

L2PvPAreaZone.java

package com.l2jserver.gameserver.model.zone.type;

import com.l2jserver.gameserver.datatables.MapRegionTable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.model.actor.instance.L2PcInstance;
import com.l2jserver.model.zone.L2SpawnZone;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;

/**
* @author  Zaldron
*/
public class L2PvpAreaZone extends L2SpawnZone
{	
private L2PcInstance activeChar;

public PvpArea(int id)
{
	super(11037);
}
        	
protected void onEnter(L2Character character)
{

	if (character instanceof L2PcInstance)
	{
		if (!character.isInsideZone(L2Character.ZONE_FLAG_PVP))
			((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));

	}

	character.setInsideZone(L2Character.ZONE_FLAG_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);
	activeChar.decayMe();
	activeChar.spawnMe();
                activeChar.isNoblesseBlessed();
	activeChar.setPvpFlag(1);
	activeChar.setTitle("Lets Fight");
	activeChar.broadcastUserInfo();
}

protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_FLAG_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);
	activeChar.decayMe();
	activeChar.spawnMe();
	activeChar.stopNoblesseBlessing(null);
	activeChar.setPvpFlag(0);
	activeChar.setTitle("");
	activeChar.broadcastUserInfo();

	if (character instanceof L2PcInstance)
	{
		if (!character.isInsideZone(L2Character.ZONE_FLAG_PVP))
			((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.LEFT_COMBAT_ZONE));
	}
}

public void onDieInside(L2Character character) {MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);}

public void onReviveInside(L2Character character) {}
}


</zone>

<zone id="11037" type="ZONE_FLAG_PVP" shape="NPoly" minZ="-3600" maxZ="-3400">
	<stat name="isPeaceZone" val="false" />
	<spawn X="x" Y="y5" Z="z" /> 

</zone>

/**
* On "x" "y" "z" you can put your pvp zone.
*/ 

 

L2Zonetype.java

+								else if(zoneType.equals("PvpFlagZone"))
+								{
+									temp = new PvpAreaZone(11037);
+								}

 

SQL

 

+INSERT INTO `zone_vertices` VALUES

+(11037,0,x,-x),

+(11037,1,x,-x),

+(110370,1,x,-x),

+(11037,2,,-x),

 

-- PVP FLAG AREA

INSERT INTO `zone_vertices` VALUES

(11037,0,x,-x),

(11037,1,x,-x),

 

 

All kind of comments are accepted . Also thanks for your time by watching the topic !

Link to comment
Share on other sites

Pathetic

Haters gonna hate , why you are posting here since there is another topic ? And yes that code was already shared on l2jfrozen forums and i dont like reshares so mutch.
Link to comment
Share on other sites

  • 3 weeks later...

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.

 Share




  • Posts

    • Probably the best C6 Pride Style server out there! Good Luck 👌
    • We are glad to announce our GRAND OPENING will be in 6 days (05/10/22) - 19:00 GMT +3 Website: https://l2interpride.com/ Discord: https://discord.gg/l2interpride General Information ・Client: Interlude ・Type: Custom PvP server ・Rates: High rates ・Starting Level: 56 ・Unique PvP Enchant system ・New PvP Synergy System ・Balanced PvP environment   Events ・Team vs Team, Capture the Flag, Death Match ・Castle Siege Event, Tournament Event   Rates ・Experience: x5000 ・Skill Points: x5000 ・Drop Rate: x1 ・Adena: x500   Enchants ・Safe Enchant: 7 ・Max Enchant: 25 ・Enchant Rate Weapon: Custom (Higher enchant = lower rate) ・Enchant Rate Armor: Custom (Higher enchant = lower rate) ・Enchant Rate Jewel: Custom (Higher enchant = lower rate)   Custom PvP Skills ・With your pvps your color name & title gonna change. ・Moreover it will be a list of pvp skills that are going tto be added on your char related to your pvps.   NPC ・Item Store: Up to S grade items, Consumables, Potions & more. ・Mysterious Merchant: Cusom Armors, Weapons, Accessories & more. ・Npc Buffer: All buffs, Scheme Buffer. ・Class Master: Free Class upgrade.   Custom Items ・Armors: (Tier 1: Titanium, Dread) (Tier 2: Pride) (Tier 3: Rykros) ・Weapons: (Tier 1: Unique) (Tier 2: Pride) (Tier 3: Relic) ・Accessories: Up to 30 Accessories with unique stats. ・Dyes-Tattoos: Custom Dyes-Tattoos with special stats.       Npc Donate ・Divine Tome of Level : Full 85 ・PvP Increaser : +500 pvp ・Elixier of CP ・Rune Drop EXP/SP Boost +50% ・Ancient Scroll of Name Change ・Body Reconstruction ・Pk Reset ・Secret scroll of Class Remastery ・Nobless   Wondrous Cubic as Teleport Gatekeeper   Farm Areas ・Our farm areas are Cave Of Trials and Forbbiden Gateway (editado)     New Augment System Status We added a New Augment System method on our server, which already exists in Pride. How it work: Status like pDef/mDef/maxHp/maxMp/maxCp/pAtk/mAtk will be multiplied from x4 to x10 compared to the descriptions of the Augment informed in the selected item. Image example where it shows Augment of maxHp, maxMp and pDef, these values are multiplied randomly, making all augments more interesting.  
    • Please help us to advertise the server then, if you can.
    • This seems very interesting if MxC be able to offer a solid community for this servers at first. Should take Valhalla-Age as example, they've built a very solid community and now are opening servers with many others big projects, Innadril and EndlessWar, under the Valhalla-Age name.   Good luck to everyone involved, will be nice to watch the development of it 🙂
    • Shut up wannabe moderator
  • 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