L2JMobius

C6 Custom Zone Flag [ Work 100% ]

Pirsys · 2 · 3078

Offline Pirsys

  • Knight
  • ***
    • Posts: 67
package org.l2jmobius.gameserver.model.zone.type.FlagZone.java
Code: [Select]
/*
 * 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.SkillTable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.zone.ZoneType;

/**
 * Bighead zones give entering players big heads
 * @author durgus
 */
public class FlagZone extends ZoneType
{
public FlagZone(int id)
{
super(id);
}

@Override
protected void onEnter(Creature creature)
{
if (creature instanceof PlayerInstance)
{
SkillTable.getInstance().getSkill(1323, 1).applyEffects(creature, creature);
((PlayerInstance) creature).setPvpFlag(1);
((PlayerInstance) creature).sendMessage("You entered a Pvp Flag zone.");
((PlayerInstance) creature).broadcastUserInfo();

}
}

@Override
protected void onExit(Creature creature)
{
if (creature instanceof PlayerInstance)
{
((PlayerInstance) creature).stopSkillEffects(1323);
((PlayerInstance) creature).setPvpFlag(0);
((PlayerInstance) creature).sendMessage("You left the Pvp Flag zone.");
((PlayerInstance) creature).broadcastUserInfo();

}
}

@Override
protected void onDieInside(Creature creature)
{
onEnter(creature);
}

@Override
protected void onReviveInside(Creature creature)
{
onEnter(creature);
}
}



package org.l2jmobius.gameserver.data.xml.ZoneData.java
add line

Code: [Select]
case "FlagZone":
{
      temp = new FlagZone(zoneId);
break;
}

L2J_Mobius_C6_Interlude\dist\game\data\zones\FlagZone.xml
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
<zone name="Primeval Isle" type="FlagZone" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- Primeval Isle (Town Zone) -->
<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" />
<spawn X="10468" Y="-24569" Z="-3645" />
</zone>
</list>

The only thing I don't know how to configure is the xml, but I used a test one, the respawn of the first island is the zone, then when you leave said respawn and enter where the mobs are, it becomes a zone of peace again.

Special thanks to Mr. Mobius, who helped me with the error I was having in the console, and I was able to lift the zone by modifying the ZoneData.java file. Thank you Mobius.




Offline Lenox102

  • Heir
  • **
    • Posts: 18
Update
Code: [Select]
/*
 * 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.SkillTable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.zone.ZoneType;

/**
 * Bighead zones give entering players big heads
 * @author durgus
 */
public class FlagZone extends ZoneType
{
public FlagZone(int id)
{
super(id);
}

@Override
protected void onEnter(Creature creature)
{
if (creature instanceof Player)
{
SkillTable.getInstance().getSkill(1323, 1).applyEffects(creature, creature);
((Player) creature).setPvpFlag(1);
((Player) creature).sendMessage("You entered a Pvp Flag zone.");
((Player) creature).broadcastUserInfo();

}
}

@Override
protected void onExit(Creature creature)
{
if (creature instanceof Player)
{
((Player) creature).stopSkillEffects(1323);
((Player) creature).setPvpFlag(0);
((Player) creature).sendMessage("You left the Pvp Flag zone.");
((Player) creature).broadcastUserInfo();

}
}

@Override
protected void onDieInside(Creature creature)
{
onEnter(creature);
}

@Override
protected void onReviveInside(Creature creature)
{
onEnter(creature);
}
}