Jump to content
  • 0

Bug Teleport Block Healers In Pvpzone


nortim

Question

Good morning, I am trying now not to find a forum needing help and I was very well attended. However, I am with a modless error that they have passed me .. The video will explain correctly what is happening, more is basically the following:

I put the area in flagzone, there blocks the healers, but when he returns to city of this bug there.

Can anyone help?

 

My Codes PvP Area:

      <zone type="FlagZone" shape="Cylinder" minZ="-11000" maxZ="-8000" rad="10000"><!-- Pagan Temple Pvp -->

  <node X="-16370" Y="-40782" />
</zone>

 

Link Post Block Healershttp://www.maxcheaters.com/topic/213502-block-bs-in-flagzone/

 

Code:

+if (character instanceof L2PcInstance)

+{
+    _player = (L2PcInstance)character;
+    final int[] supporters = {15,16,29,30,42,43,97,105,112,115,136,116}; // support classes ID's
+    for (int act : supporters)
+    if (_player.getActiveClass() == act)
+    {
+        _player.sendMessage("You can't enter in flag zone with a support class.");
+        _player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);
+    }
+}

 

Video: https://youtu.be/d3vxJpvZT1g

 

Link to comment
Share on other sites

Recommended Posts

  • 0

Ok friend.

 

onEnter:

 @Override

  protected void onEnter(L2Character character)
  {
    if ((character instanceof L2PcInstance))
    {
    if(character.getLevel() >= Config.ALLOW_FLAG_ZONE_MINILVL && character.getLevel() <= Config.ALLOW_FLAG_ZONE_MAXLVL)
    {
    ((L2PcInstance)character).teleToLocation(Config.ALLOW_FLAGl_ZONE_X, Config.ALLOW_FLAGl_ZONE_Y, Config.ALLOW_FLAGl_ZONE_Z);
    showHtmlLevel((L2PcInstance)character);
    return;
    }
    
    if (character instanceof L2PcInstance)
    {
    L2PcInstance _player = (L2PcInstance)character;
    final int[] supporters = {15,16,29,30,42,43,97,105,112,115,136,116}; // support classes ID's
    for (int act : supporters)
    if  (_player.getActiveClass() == act)
    {
    _player.sendMessage("You can't enter in flag zone with a support class.");
    _player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);
    }
    }
    
      if (Config.RECEIVE_NOBLESSE)
      {
        this.noblesse.getEffects(character, character);
      }
      ((L2PcInstance)character).stopPvPFlag();
      ((L2PcInstance)character).updatePvPFlag(1);
      if (Config.MSG_ON_ENTER_FLAG)
      {
        ((L2PcInstance)character).sendMessage("[Wizard Zone]: " + Config.MESSAGE_ON_ENTER + ".");
      }
   
    
if (Config.ALLOW_FLAG_ZONE_TITLE)
{
  ((L2PcInstance)character).getAppearance().setTitleColor(Config.FLAG_ZONE_TITLE_COLOR);
}
   
if (Config.ALLOW_FLAG_ZONE_NAME)
{
  ((L2PcInstance)character).getAppearance().setNameColor(Config.FLAG_ZONE_NAME_COLOR);
}
 
    if(!_FlagZone && Config.ZONE_TOWN != 2)
{
character.setInsideZone(L2Character.ZONE_FLAGZONE, true);
}
    }
  }

 
onExit:

onExit:  @Override
protected void onExit(L2Character character)
  {
    if ((character instanceof L2PcInstance))
    {
      ((L2PcInstance)character).updatePvPFlag(0);
      if (Config.MSG_ON_ENTER_FLAG) {
        ((L2PcInstance)character).sendMessage("[Wizard Zone]: " + Config.MESSAGE_ON_EXIT + ".");
      }
    
if (Config.ALLOW_FLAG_ZONE_TITLE)
{
       ((L2PcInstance)character).getAppearance().setTitleColor(Config.NAME_COLOR);
}
if (Config.ALLOW_FLAG_ZONE_NAME)
{
       ((L2PcInstance)character).getAppearance().setNameColor(Config.TITLE_COLOR);
}
 
    if(!_FlagZone)
{
character.setInsideZone(L2Character.ZONE_FLAGZONE, false);
}
    }
  }
  
  @Override
  public void onDieInside(L2Character character) {}
  
  @Override
  public void onReviveInside(L2Character character)
  {
    onEnter(character);
    if (Config.RECEIVE_NOBLESSE)
    {
      this.noblesse.getEffects(character, character);
    }
  }

Edited by nortim
Link to comment
Share on other sites

  • 0

Replace with these lines until nobless part

protected void onEnter(final L2Character character)
{
	if ((character instanceof L2PcInstance))
	{
		L2PcInstance player = (L2PcInstance) character;
		if (player.getLevel() < Config.ALLOW_FLAG_ZONE_MINILVL || player.getLevel() > Config.ALLOW_FLAG_ZONE_MAXLVL)
		{
			player.teleToLocation(Config.ALLOW_FLAGl_ZONE_X, Config.ALLOW_FLAGl_ZONE_Y, Config.ALLOW_FLAGl_ZONE_Z);
			showHtmlLevel(player);
			return;
		}
		final List<Integer> supportClasses = Arrays.asList(15, 16, 29, 30, 42, 43, 97, 105, 112, 115, 136, 116); // support classes ID's
		if (supportClasses.contains(player.getActiveClass()))
		{
			player.sendMessage("You can't enter in flag zone with a support class.");
			player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);
                        return;
		}

for missing imports use ctrl shift O

 

i believe the first check should be as i did , check for lower / higher lvl than this zone requires.. i dont think u want to be teleport when u just entering in this zone? 

Edited by melron
Link to comment
Share on other sites

  • 0

Replace with these lines until nobless part

protected void onEnter(final L2Character character)
{
	if ((character instanceof L2PcInstance))
	{
		L2PcInstance player = (L2PcInstance) character;
		if (player.getLevel() < Config.ALLOW_FLAG_ZONE_MINILVL || player.getLevel() > Config.ALLOW_FLAG_ZONE_MAXLVL)
		{
			player.teleToLocation(Config.ALLOW_FLAGl_ZONE_X, Config.ALLOW_FLAGl_ZONE_Y, Config.ALLOW_FLAGl_ZONE_Z);
			showHtmlLevel(player);
			return;
		}
		final List<Integer> supportClasses = Arrays.asList(15, 16, 29, 30, 42, 43, 97, 105, 112, 115, 136, 116); // support classes ID's
		if (supportClasses.contains(player.getActiveClass()))
		{
			player.sendMessage("You can't enter in flag zone with a support class.");
			player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);
                        return;
		}

for missing imports use ctrl shift O

 

i believe the first check should be as i did , check for lower / higher lvl than this zone requires.. i dont think u want to be teleport when u just entering in this zone? 

 
Still giving the same error :(
 
3328ja1.png
Edited by nortim
Link to comment
Share on other sites

  • 0

change both

player.teleToLocation(Config.ALLOW_FLAGl_ZONE_X, Config.ALLOW_FLAGl_ZONE_Y, Config.ALLOW_FLAGl_ZONE_Z);
player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);

to

ThreadPoolManager.getInstance().executeTask(new KickPlayer(player);

add this too above the last } at the end of the file

private static final class KickPlayer implements Runnable
{
	private L2PcInstance _player;
	
	public KickPlayer(L2PcInstance player)
	{
		_player = player;
	}
	
	@Override
	public void run()
	{
		if (_player != null)
		{
			final L2Summon summon = _player.getPet();
			if (summon != null)
				summon.unSummon(_player);
			
			_player.teleToLocation(_player.teleToLocation(Config.ALLOW_FLAGl_ZONE_X, Config.ALLOW_FLAGl_ZONE_Y, Config.ALLOW_FLAGl_ZONE_Z););
			_player = null;
		}
	}
}
Edited by melron
Link to comment
Share on other sites

  • 0

This was my code

+if (character instanceof L2PcInstance)
+{
+    _player = (L2PcInstance)character;
+    final int[] supporters = {15,16,29,30,42,43,97,105,112,115,136,116}; // support classes ID's
+    for (int act : supporters)
+    if (_player.getActiveClass() == act)
+    {
+        _player.sendMessage("You can't enter in flag zone with a support class.");
+        _player.teleToLocation(83417 + Rnd.get(101) - 50, 149028 + Rnd.get(101) - 50, -3408);
+    }
+}

Into onEnter moethod inside FlagZone code. I don't think missing the return statement would change anything at all since when player gets teleport onExit method is taking place. Plus he didn't make any changes (after the teleport) that would have to restore into onExit method

 

No clue about why it doesn't work on L2JFrozen, probably they miss some isTeleporting() check and everything is melting. Who knows. You're right about the return it's not needed here, but could be depending how you code it.

 

I wouldn't make all those things anyway, logical way is to restrict teleport from the beginning, not "teleport the dude, then teleport him again once he reached the spot to another location". You just waste ressources.

 

A simple

if (ArraysUtil.contains(classId, ARRAY_TO_CHECK))
{
    player.sendMessage("Blabla");
    return;
}

on 2 places (gatekeeper bypass and SummonFriend skillhandler) is enough to handle the problem.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

 

## Eclipse Workspace Patch 1.0

#P L2jFrozen_GameServer

Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 1004)

+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy)

@@ -311,8 +311,8 @@

/** The Constant ZONE_CLANHALL. */

public static final int ZONE_CLANHALL = 16;

 

- /** The Constant ZONE_UNUSED. */

- public static final int ZONE_UNUSED = 32;

+ /** The Constant ZONE_NO_HEALER. */

+ public static final int ZONE_NO_HEALER = 32;

 

/** The Constant ZONE_NOLANDING. */

public static final int ZONE_NOLANDING = 64;

Index: head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java (revision 0)

+++ head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java (working copy)

@@ -0,0 +1,257 @@

+/*

+ * 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.l2jfrozen.gameserver.model.zone.type;

+

+import java.util.List;

+import java.util.concurrent.Future;

+

+import javolution.util.FastList;

+

+import com.l2jfrozen.gameserver.datatables.SkillTable;

+import com.l2jfrozen.gameserver.model.L2Character;

+import com.l2jfrozen.gameserver.model.L2Skill;

+import com.l2jfrozen.gameserver.model.actor.instance.L2MonsterInstance;

+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;

+import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;

+import com.l2jfrozen.gameserver.model.zone.L2ZoneType;

+import com.l2jfrozen.gameserver.thread.ThreadPoolManager;

+import com.l2jfrozen.util.random.Rnd;

+

+/**

+ * @author Strato

+ * @author Elfocrash (for the correction)

+ */

+public class L2FlagZone extends L2ZoneType

+{

+ private int _skillId;

+ private int _chance;

+ private int _initialDelay;

+ private int _skillLvl;

+ private int _reuse;

+ private boolean _enabled;

+ private String _target;

+ private Future<?> _task;

+ private static List<Integer> _forbiddenClasses = new FastList<Integer>();

+

+ public L2FlagZone(int id)

+ {

+ super(id);

+ _skillId = 1323;

+ _skillLvl = 1;

+ _chance = 100;

+ _initialDelay = 0;

+ _reuse = 30000;

+ _enabled = true;

+ _target = "pc";

+ }

+

+ @Override

+ public void setParameter(String name, String value)

+ {

+ if (name.equals("skillId"))

+ {

+ _skillId = Integer.parseInt(value);

+ }

+ else if (name.equals("skillLvl"))

+ {

+ _skillLvl = Integer.parseInt(value);

+ }

+ else if (name.equals("chance"))

+ {

+ _chance = Integer.parseInt(value);

+ }

+ else if (name.equals("initialDelay"))

+ {

+ _initialDelay = Integer.parseInt(value);

+ }

+ else if (name.equals("default_enabled"))

+ {

+ _enabled = Boolean.parseBoolean(value);

+ }

+ else if (name.equals("target"))

+ {

+ _target = String.valueOf(value);

+ }

+ else if (name.equals("reuse"))

+ {

+ _reuse = Integer.parseInt(value);

+ }

+ else if (name.equals("classes"))

+ {

+ String[] propertySplit = value.split(",");

+ for (String classId : propertySplit)

+ {

+ int classes = Integer.parseInt(classId);

+ _forbiddenClasses.add(classes);

+ }

+ }

+ else

+ {

+ super.setParameter(name, value);

+ }

+ }

+

+ @Override

+ protected void onEnter(L2Character character)

+ {

+ if (character instanceof L2PcInstance)

+ {

+ character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

+ character.setInsideZone(L2Character.ZONE_NO_HEALER, true);

+ if (isForbiddenClass(((L2PcInstance) character)))

+ {

+ for (L2Skill skill : character.getAllSkills())

+ {

+ switch (skill.getSkillType())

+ {

+ case HEAL:

+ case HEAL_PERCENT:

+ case BALANCE_LIFE:

+ case RESURRECT:

+ character.disableSkill(skill.getId());

+ break;

+ }

+ }

+ }

+

+ // Set pvp flag

+ ((L2PcInstance) character).setPvpFlag(1);

+ ((L2PcInstance) character).sendMessage("Zona Flag!!!");

+ ((L2PcInstance) character).broadcastUserInfo();

+ if ((character instanceof L2PlayableInstance && _target.equalsIgnoreCase("pc") || character instanceof L2PcInstance && _target.equalsIgnoreCase("pc_only") || character instanceof L2MonsterInstance && _target.equalsIgnoreCase("npc")) && _task == null)

+ {

+ _task = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new ApplySkill(/* this */), _initialDelay, _reuse);

+ }

+ }

+ }

+

+ @Override

+ protected void onExit(L2Character character)

+ {

+ if (character instanceof L2PcInstance)

+ {

+ character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

+ character.setInsideZone(L2Character.ZONE_NO_HEALER, false);

+ if (isForbiddenClass(((L2PcInstance) character)))

+ {

+ for (L2Skill skill : character.getAllSkills())

+ {

+ switch (skill.getSkillType())

+ {

+ case HEAL:

+ case HEAL_PERCENT:

+ case BALANCE_LIFE:

+ case RESURRECT:

+ character.enableSkill(skill.getId());

+ break;

+ }

+ }

+ }

+

+ ((L2PcInstance) character).setPvpFlag(0);

+ ((L2PcInstance) character).sendMessage("Zona no Flag!!");

+ ((L2PcInstance) character).broadcastUserInfo();

+ }

+ if (_characterList.isEmpty() && _task != null)

+ {

+ _task.cancel(true);

+ _task = null;

+ }

+ }

+

+ public L2Skill getSkill()

+ {

+ return SkillTable.getInstance().getInfo(_skillId, _skillLvl);

+ }

+

+ public String getTargetType()

+ {

+ return _target;

+ }

+

+ public boolean isEnabled()

+ {

+ return _enabled;

+ }

+

+ public int getChance()

+ {

+ return _chance;

+ }

+

+ public void setZoneEnabled(boolean val)

+ {

+ _enabled = val;

+ }

+

+ class ApplySkill implements Runnable

+ {

+ @Override

+ public void run()

+ {

+ if (isEnabled())

+ {

+ for (L2Character temp : _characterList.values())

+ {

+ if (temp != null && !temp.isDead())

+ {

+ if ((temp instanceof L2PlayableInstance && getTargetType().equalsIgnoreCase("pc") || temp instanceof L2PcInstance && getTargetType().equalsIgnoreCase("pc_only") || temp instanceof L2MonsterInstance && getTargetType().equalsIgnoreCase("npc")) && Rnd.get(100) < getChance())

+ {

+ L2Skill skill = null;

+ if ((skill = getSkill()) == null)

+ {

+ System.out.println("ATTENTION: error on zone with id " + getId());

+ System.out.println("Skill " + _skillId + "," + _skillLvl + " not present between skills");

+ }

+ else

+ skill.getEffects(temp, temp);

+ }

+ }

+ }

+ }

+ }

+ }

+

+ public static boolean isForbiddenClass(L2PcInstance player)

+ {

+ if (player.isGM())

+ return false;

+

+ if (_forbiddenClasses == null)

+ return false;

+

+ if (_forbiddenClasses.contains(player.getClassId().getId()))

+ return true;

+

+ return false;

+ }

+

+ public static List<Integer> getForbiddenClasses()

+ {

+ return _forbiddenClasses;

+ }

+

+ @Override

+ public void onDieInside(L2Character character)

+ {

+

+ }

+

+ @Override

+ public void onReviveInside(L2Character character)

+ {

+ onEnter(character);

+ }

+}

Index: head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java (revision 1004)

+++ head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java (working copy)

@@ -55,6 +55,7 @@

import com.l2jfrozen.gameserver.model.zone.type.L2DerbyTrackZone;

import com.l2jfrozen.gameserver.model.zone.type.L2EffectZone;

import com.l2jfrozen.gameserver.model.zone.type.L2FishingZone;

+import com.l2jfrozen.gameserver.model.zone.type.L2FlagZone;

import com.l2jfrozen.gameserver.model.zone.type.L2FortZone;

import com.l2jfrozen.gameserver.model.zone.type.L2JailZone;

import com.l2jfrozen.gameserver.model.zone.type.L2MotherTreeZone;

@@ -283,6 +284,10 @@

{

temp = new L2SwampZone(zoneId);

}

+ else if(zoneType.equals("FlagZone"))

+ {

+ temp = new L2FlagZone(zoneId);

+ }

 

// Check for unknown type

if(temp == null)

#P L2jFrozen_DataPack

Index: data/zones/zone.xml

===================================================================

--- data/zones/zone.xml (revision 1004)

+++ data/zones/zone.xml (working copy)

@@ -275,11 +275,12 @@

<spawn X='17577' Y='170128' Z='-3534'/>

<spawn X='19737' Y='170976' Z='-3583'/>

</zone>

-<zone id='11037' type='Town' shape='Cuboid' minZ='-3500' maxZ='-3400'>

+ <zone id='11037' type='FlagZone' shape='Cuboid' minZ='-3800' maxZ='-3100'>

<stat name='name' val='Primeval Isle'/>

<stat name='townId' val='19'/>

<stat name='taxById' val='8'/>

<stat name='noPeace' val='true'/>

+ <stat name='classes' val='97,105,112' />

<spawn X='10468' Y='-24569' Z='-3645'/>

<spawn X='10928' Y='-24641' Z='-3643'/>

<spawn X='8480' Y='-23706' Z='-3727'/>

 

 

I added this mod above (of the spoiler) and it worked, but when the char leaves the area the skill buga and has that of the rr, would like someone complement to when to leave the zone the skill to return to work?

Link to comment
Share on other sites

  • 0

No clue about why it doesn't work on L2JFrozen, probably they miss some isTeleporting() check and everything is melting. Who knows. You're right about the return it's not needed here, but could be depending how you code it.

 

I wouldn't make all those things anyway, logical way is to restrict teleport from the beginning, not "teleport the dude, then teleport him again once he reached the spot to another location". You just waste ressources.

 

A simple

if (ArraysUtil.contains(classId, ARRAY_TO_CHECK))
{
    player.sendMessage("Blabla");
    return;
}

on 2 places (gatekeeper bypass and SummonFriend skillhandler) is enough to handle the problem.

 

You dont restrict the player to walk (with feet) into this zone though :(

Link to comment
Share on other sites

  • 0

You dont restrict the player to walk (with feet) into this zone though :(

is simple example for how you can use return command on java ...

if you need more command add it before return ...
 
2 days for 1 return gj boys :)
Edited by pirama
Link to comment
Share on other sites

  • 0

 

is simple example for how you can use return command on java ...

if you need more command add it before return ...
 
2 days for 1 return gj boys :)

 

Its not return problem as Solomun said ... When the player get teleport the method onExit is taking place.

 

Just frozens problem. i just tried it with the default teleport out (kick) , when a player go in oly arena without playing match.

player going in town but cant move... when i edited with my last example (as acis gots) worked fine.

 

Results: frozen sux

Edited by melron
Link to comment
Share on other sites

  • 0

Its not return problem as Solomun said ... When the player get teleport the method onExit is taking place.

 

Just frozens problem. i just tried it with the default teleport out (kick) , when a player go in oly arena without playing match.

player going in town but cant move... when i edited with my last example (as acis gots) worked fine.

 

Results: frozen sux

code is shit without return ... you use this check for stop the enter on zone, but without return dont stop method onEnter and let it to start flag and other 

[gr] o codikas mpori se kapio pack na douleyh xoris ayto na simeni oti o codikas einai sosta gramenos

kai gia na sto dosw na to katalabis kai me paradigma einai san na min xrisimopihs break se for

public L2PcInstance getMe(L2PcInstance eimai)
{
L2PcInstance player = null;

 for(L2PcInstance egw : listplayers)
 {
   if(egw.equals(eimai)
     player = egw;
 }
 return player;
}

kai

public L2PcInstance getMe(L2PcInstance eimai)
{
L2PcInstance player = null;

 for(L2PcInstance egw : listplayers)
 {
   if(egw.equals(eimai)
   {
     player = egw;
     break;
   }
 }
 return player;
}

tha dosoun to idio apotelesma o sostos tropos einai o deyteros me to break

poso malon stis zone pou meta ton elenxo setaris kai alla ston paixti ... kai ksana lew mpori na douleyh opos les se allo pack ( alla ayto den simeni oti einai kai sosta gramenos o codikas )

Link to comment
Share on other sites

  • 0

@Pirama

[gr] nai entaksei gia ta upoloipa mporeis na valeis return apla den ton enoiazei afto gia ta title ktlp apo oti eipe.. to movement kai to target skalwne

anyway sto thema teleport exei thema to frozen. Parafta me ton threadpool pou tou edwsa doulevei

 

edit: me return tou to eixa dwsei gia ton logo pou eipes apla to return den tha eftiaxne to provlhma tou

Edited by melron
Link to comment
Share on other sites

  • 0

@Pirama

[gr] nai entaksei gia ta upoloipa mporeis na valeis return apla den ton enoiazei afto gia ta title ktlp apo oti eipe.. to movement kai to target skalwne

anyway sto thema teleport exei thema to frozen. Parafta me ton threadpool pou tou edwsa doulevei

[gr] an den kanw lathos kai me ActionFailed.STATIC_PACKET tha ksekolage ... tespa afoy sas doulepse etsi kai iste ikanopihmeni .. gj :)

Link to comment
Share on other sites

  • 0

 

## Eclipse Workspace Patch 1.0

#P L2jFrozen_GameServer

Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 1004)

+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy)

@@ -311,8 +311,8 @@

/** The Constant ZONE_CLANHALL. */

public static final int ZONE_CLANHALL = 16;

 

- /** The Constant ZONE_UNUSED. */

- public static final int ZONE_UNUSED = 32;

+ /** The Constant ZONE_NO_HEALER. */

+ public static final int ZONE_NO_HEALER = 32;

 

/** The Constant ZONE_NOLANDING. */

public static final int ZONE_NOLANDING = 64;

Index: head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java (revision 0)

+++ head-src/com/l2jfrozen/gameserver/model/zone/type/L2FlagZone.java (working copy)

@@ -0,0 +1,257 @@

+/*

+ * 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.l2jfrozen.gameserver.model.zone.type;

+

+import java.util.List;

+import java.util.concurrent.Future;

+

+import javolution.util.FastList;

+

+import com.l2jfrozen.gameserver.datatables.SkillTable;

+import com.l2jfrozen.gameserver.model.L2Character;

+import com.l2jfrozen.gameserver.model.L2Skill;

+import com.l2jfrozen.gameserver.model.actor.instance.L2MonsterInstance;

+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;

+import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;

+import com.l2jfrozen.gameserver.model.zone.L2ZoneType;

+import com.l2jfrozen.gameserver.thread.ThreadPoolManager;

+import com.l2jfrozen.util.random.Rnd;

+

+/**

+ * @author Strato

+ * @author Elfocrash (for the correction)

+ */

+public class L2FlagZone extends L2ZoneType

+{

+ private int _skillId;

+ private int _chance;

+ private int _initialDelay;

+ private int _skillLvl;

+ private int _reuse;

+ private boolean _enabled;

+ private String _target;

+ private Future<?> _task;

+ private static List<Integer> _forbiddenClasses = new FastList<Integer>();

+

+ public L2FlagZone(int id)

+ {

+ super(id);

+ _skillId = 1323;

+ _skillLvl = 1;

+ _chance = 100;

+ _initialDelay = 0;

+ _reuse = 30000;

+ _enabled = true;

+ _target = "pc";

+ }

+

+ @Override

+ public void setParameter(String name, String value)

+ {

+ if (name.equals("skillId"))

+ {

+ _skillId = Integer.parseInt(value);

+ }

+ else if (name.equals("skillLvl"))

+ {

+ _skillLvl = Integer.parseInt(value);

+ }

+ else if (name.equals("chance"))

+ {

+ _chance = Integer.parseInt(value);

+ }

+ else if (name.equals("initialDelay"))

+ {

+ _initialDelay = Integer.parseInt(value);

+ }

+ else if (name.equals("default_enabled"))

+ {

+ _enabled = Boolean.parseBoolean(value);

+ }

+ else if (name.equals("target"))

+ {

+ _target = String.valueOf(value);

+ }

+ else if (name.equals("reuse"))

+ {

+ _reuse = Integer.parseInt(value);

+ }

+ else if (name.equals("classes"))

+ {

+ String[] propertySplit = value.split(",");

+ for (String classId : propertySplit)

+ {

+ int classes = Integer.parseInt(classId);

+ _forbiddenClasses.add(classes);

+ }

+ }

+ else

+ {

+ super.setParameter(name, value);

+ }

+ }

+

+ @Override

+ protected void onEnter(L2Character character)

+ {

+ if (character instanceof L2PcInstance)

+ {

+ character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

+ character.setInsideZone(L2Character.ZONE_NO_HEALER, true);

+ if (isForbiddenClass(((L2PcInstance) character)))

+ {

+ for (L2Skill skill : character.getAllSkills())

+ {

+ switch (skill.getSkillType())

+ {

+ case HEAL:

+ case HEAL_PERCENT:

+ case BALANCE_LIFE:

+ case RESURRECT:

+ character.disableSkill(skill.getId());

+ break;

+ }

+ }

+ }

+

+ // Set pvp flag

+ ((L2PcInstance) character).setPvpFlag(1);

+ ((L2PcInstance) character).sendMessage("Zona Flag!!!");

+ ((L2PcInstance) character).broadcastUserInfo();

+ if ((character instanceof L2PlayableInstance && _target.equalsIgnoreCase("pc") || character instanceof L2PcInstance && _target.equalsIgnoreCase("pc_only") || character instanceof L2MonsterInstance && _target.equalsIgnoreCase("npc")) && _task == null)

+ {

+ _task = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new ApplySkill(/* this */), _initialDelay, _reuse);

+ }

+ }

+ }

+

+ @Override

+ protected void onExit(L2Character character)

+ {

+ if (character instanceof L2PcInstance)

+ {

+ character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

+ character.setInsideZone(L2Character.ZONE_NO_HEALER, false);

+ if (isForbiddenClass(((L2PcInstance) character)))

+ {

+ for (L2Skill skill : character.getAllSkills())

+ {

+ switch (skill.getSkillType())

+ {

+ case HEAL:

+ case HEAL_PERCENT:

+ case BALANCE_LIFE:

+ case RESURRECT:

+ character.enableSkill(skill.getId());

+ break;

+ }

+ }

+ }

+

+ ((L2PcInstance) character).setPvpFlag(0);

+ ((L2PcInstance) character).sendMessage("Zona no Flag!!");

+ ((L2PcInstance) character).broadcastUserInfo();

+ }

+ if (_characterList.isEmpty() && _task != null)

+ {

+ _task.cancel(true);

+ _task = null;

+ }

+ }

+

+ public L2Skill getSkill()

+ {

+ return SkillTable.getInstance().getInfo(_skillId, _skillLvl);

+ }

+

+ public String getTargetType()

+ {

+ return _target;

+ }

+

+ public boolean isEnabled()

+ {

+ return _enabled;

+ }

+

+ public int getChance()

+ {

+ return _chance;

+ }

+

+ public void setZoneEnabled(boolean val)

+ {

+ _enabled = val;

+ }

+

+ class ApplySkill implements Runnable

+ {

+ @Override

+ public void run()

+ {

+ if (isEnabled())

+ {

+ for (L2Character temp : _characterList.values())

+ {

+ if (temp != null && !temp.isDead())

+ {

+ if ((temp instanceof L2PlayableInstance && getTargetType().equalsIgnoreCase("pc") || temp instanceof L2PcInstance && getTargetType().equalsIgnoreCase("pc_only") || temp instanceof L2MonsterInstance && getTargetType().equalsIgnoreCase("npc")) && Rnd.get(100) < getChance())

+ {

+ L2Skill skill = null;

+ if ((skill = getSkill()) == null)

+ {

+ System.out.println("ATTENTION: error on zone with id " + getId());

+ System.out.println("Skill " + _skillId + "," + _skillLvl + " not present between skills");

+ }

+ else

+ skill.getEffects(temp, temp);

+ }

+ }

+ }

+ }

+ }

+ }

+

+ public static boolean isForbiddenClass(L2PcInstance player)

+ {

+ if (player.isGM())

+ return false;

+

+ if (_forbiddenClasses == null)

+ return false;

+

+ if (_forbiddenClasses.contains(player.getClassId().getId()))

+ return true;

+

+ return false;

+ }

+

+ public static List<Integer> getForbiddenClasses()

+ {

+ return _forbiddenClasses;

+ }

+

+ @Override

+ public void onDieInside(L2Character character)

+ {

+

+ }

+

+ @Override

+ public void onReviveInside(L2Character character)

+ {

+ onEnter(character);

+ }

+}

Index: head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java (revision 1004)

+++ head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java (working copy)

@@ -55,6 +55,7 @@

import com.l2jfrozen.gameserver.model.zone.type.L2DerbyTrackZone;

import com.l2jfrozen.gameserver.model.zone.type.L2EffectZone;

import com.l2jfrozen.gameserver.model.zone.type.L2FishingZone;

+import com.l2jfrozen.gameserver.model.zone.type.L2FlagZone;

import com.l2jfrozen.gameserver.model.zone.type.L2FortZone;

import com.l2jfrozen.gameserver.model.zone.type.L2JailZone;

import com.l2jfrozen.gameserver.model.zone.type.L2MotherTreeZone;

@@ -283,6 +284,10 @@

{

temp = new L2SwampZone(zoneId);

}

+ else if(zoneType.equals("FlagZone"))

+ {

+ temp = new L2FlagZone(zoneId);

+ }

 

// Check for unknown type

if(temp == null)

#P L2jFrozen_DataPack

Index: data/zones/zone.xml

===================================================================

--- data/zones/zone.xml (revision 1004)

+++ data/zones/zone.xml (working copy)

@@ -275,11 +275,12 @@

<spawn X='17577' Y='170128' Z='-3534'/>

<spawn X='19737' Y='170976' Z='-3583'/>

</zone>

-<zone id='11037' type='Town' shape='Cuboid' minZ='-3500' maxZ='-3400'>

+ <zone id='11037' type='FlagZone' shape='Cuboid' minZ='-3800' maxZ='-3100'>

<stat name='name' val='Primeval Isle'/>

<stat name='townId' val='19'/>

<stat name='taxById' val='8'/>

<stat name='noPeace' val='true'/>

+ <stat name='classes' val='97,105,112' />

<spawn X='10468' Y='-24569' Z='-3645'/>

<spawn X='10928' Y='-24641' Z='-3643'/>

<spawn X='8480' Y='-23706' Z='-3727'/>

 

 

I added this mod above (of the spoiler) and it worked, but when the char leaves the area the skill buga and has that of the rr, would like someone complement to when to leave the zone the skill to return to work?

 

Could anyone complement this code? So that when leaving the zone the skills come back to work ..

Link to comment
Share on other sites

  • 0

[gr] an den kanw lathos kai me ActionFailed.STATIC_PACKET tha ksekolage ... tespa afoy sas doulepse etsi kai iste ikanopihmeni .. gj :)

 

@Pirama

[gr] nai entaksei gia ta upoloipa mporeis na valeis return apla den ton enoiazei afto gia ta title ktlp apo oti eipe.. to movement kai to target skalwne

anyway sto thema teleport exei thema to frozen. Parafta me ton threadpool pou tou edwsa doulevei

 

edit: me return tou to eixa dwsei gia ton logo pou eipes apla to return den tha eftiaxne to provlhma tou

 

code is shit without return ... you use this check for stop the enter on zone, but without return dont stop method onEnter and let it to start flag and other 

[gr] o codikas mpori se kapio pack na douleyh xoris ayto na simeni oti o codikas einai sosta gramenos

kai gia na sto dosw na to katalabis kai me paradigma einai san na min xrisimopihs break se for

public L2PcInstance getMe(L2PcInstance eimai)
{
L2PcInstance player = null;

 for(L2PcInstance egw : listplayers)
 {
   if(egw.equals(eimai)
     player = egw;
 }
 return player;
}

kai

public L2PcInstance getMe(L2PcInstance eimai)
{
L2PcInstance player = null;

 for(L2PcInstance egw : listplayers)
 {
   if(egw.equals(eimai)
   {
     player = egw;
     break;
   }
 }
 return player;
}

tha dosoun to idio apotelesma o sostos tropos einai o deyteros me to break

poso malon stis zone pou meta ton elenxo setaris kai alla ston paixti ... kai ksana lew mpori na douleyh opos les se allo pack ( alla ayto den simeni oti einai kai sosta gramenos o codikas )

 

 
The error still persists .. could anyone else help? (I.e.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...