L2JMobius

CT0 Pvp Flag Zone

Lenox102 · 3 · 219

Offline Lenox102

  • Heir
  • **
    • Posts: 18
Code: [Select]

diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/xsd/zones.xsd b/L2J_Mobius_CT_0_Interlude/dist/game/data/xsd/zones.xsd
index 5b36b5e..9497c9a 100644
--- a/L2J_Mobius_CT_0_Interlude/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/xsd/zones.xsd
@@ -148,6 +148,7 @@
  <xs:enumeration value="TerritoryWarZone" />
  <xs:enumeration value="TownZone" />
  <xs:enumeration value="WaterZone" />
+ <xs:enumeration value="FlagZone" />
  </xs:restriction>
  </xs:simpleType>
  </xs:attribute>
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/zones/pvp_flag.xml b/L2J_Mobius_CT_0_Interlude/dist/game/data/zones/pvp_flag.xml
new file mode 100644
index 0000000..7f02df2
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/zones/pvp_flag.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
+ <!-- Primeval Isle (Town Zone) -->
+ <zone name="Primeval Isle" type="FlagZone" shape="Cuboid" minZ="-4650" maxZ="1900">
+ <node X="0" Y="-32767" />
+ <node X="32767" Y="-0" />
+ <spawn X="10117" Y="-25199" Z="-3696" />
+ <spawn X="11764" Y="-24600" Z="-3640" />
+ <spawn X="10716" Y="-22527" Z="-3656" />
+ <spawn X="9423" Y="-23077" Z="-3688" />
+ <spawn X="7892" Y="-22642" Z="-3672" />
+ <spawn X="5443" Y="-23451" Z="-3704" />
+ </zone>
+</list>
\ No newline at end of file
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index d2f5315..9afe82d 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -42,7 +42,8 @@
  ALTERED,
  NO_BOOKMARK,
  NO_ITEM_DROP,
- NO_RESTART;
+ NO_RESTART,
+ PVP_FLAG;
 
  public static int getZoneCount()
  {
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/type/FlagZone.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/type/FlagZone.java
new file mode 100644
index 0000000..6188333
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/zone/type/FlagZone.java
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.gameserver.data.xml.SkillData;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * @author durgus
+ */
+public class FlagZone extends ZoneType
+{
+ public FlagZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (creature.isPlayer() && !creature.isInsideZone(ZoneId.PVP_FLAG))
+ {
+ SkillData.getInstance().getSkill(1323, 1).applyEffects(creature, creature);
+ creature.updatePvPFlag(1);
+ creature.sendMessage("You entered a PVP Flag zone.");
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (creature.isPlayer() && !creature.isInsideZone(ZoneId.PVP_FLAG))
+ {
+ creature.updatePvPFlag(0);
+ creature.sendMessage("You left the PVP Flag zone.");
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void onDieInside(Creature creature)
+ {
+ onEnter(creature);
+ }
+
+ @Override
+ public void onReviveInside(Creature creature)
+ {
+ onEnter(creature);
+ }
+}
\ No newline at end of file


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
Thanks for sharing!


Instead of removing the flag, it should probably start the timer that the user has stopped pvp, so that his flag will disappear in a few seconds. Players can exit the zone in the last second and their attacker can get PK.

The same issue comes with the healing part. Players could abuse it to restore their HP by re-entering the zone.


Offline Lenox102

  • Heir
  • **
    • Posts: 18
Thanks. I have to remove that and change the config RespawnRestoreCP, RespawnRestoreHP and RespawnRestoreMP instead.