Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =================================================
- Index: gameserver.taskmanager.PvpFlagTaskManager.JAVA
- =================================================
- +package l2j.dev.gameserver.taskmanager;
- +
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +
- +import l2j.dev.commons.concurrent.ThreadPool;
- +import l2j.dev.gameserver.model.actor.instance.PlayerInstance;
- +import l2j.dev.gameserver.model.zone.ZoneId;
- +
- +/**
- + * @author Juvenil Walker
- + */
- +public class PvpFlagTaskManager implements Runnable
- +{
- + private final Map<PlayerInstance, Long> _players = new ConcurrentHashMap<>();
- +
- + protected PvpFlagTaskManager()
- + {
- + // Run task each second.
- + ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
- + }
- +
- + public final void add(PlayerInstance player, long time)
- + {
- + _players.put(player, System.currentTimeMillis() + time);
- + }
- +
- + public final void remove(PlayerInstance player)
- + {
- + _players.remove(player);
- + }
- +
- + @Override
- + public final void run()
- + {
- + // List is empty, skip.
- + if (_players.isEmpty())
- + {
- + return;
- + }
- +
- + // Get current time.
- + final long currentTime = System.currentTimeMillis();
- +
- + // Loop all players.
- + for (Map.Entry<PlayerInstance, Long> entry : _players.entrySet())
- + {
- + // Get time left and check.
- + final PlayerInstance player = entry.getKey();
- +
- + if (player.isInsideZone(ZoneId.CHAOT))
- + {
- + _players.remove(player);
- + continue;
- + }
- +
- + final long timeLeft = entry.getValue();
- +
- + // Time is running out, clear PvP flag and remove from list.
- + if (currentTime > timeLeft)
- + {
- + player.updatePvPFlag(0);
- + _players.remove(player);
- + }
- + // Time almost runned out, update to blinking PvP flag.
- + else if (currentTime > (timeLeft - 5000))
- + {
- + player.updatePvPFlag(2);
- + // Time didn't run out, keep PvP flag.
- + }
- + else
- + {
- + player.updatePvPFlag(1);
- + }
- + }
- + }
- +
- + public static final PvpFlagTaskManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final PvpFlagTaskManager _instance = new PvpFlagTaskManager();
- + }
- +}
- ==============================================================
- Index: l2j.dev.gameserver.model.zone.ZoneId.JAVA
- ==============================================================
- SCRIPT,
- SIEGE,
- TOWN,
- SWAMP,
- WATER,
- + CHAOT;
- ==============================================================
- Index: gameserver.model.zone.type.ChaoticZone.JAVA
- ==============================================================
- +package l2j.dev.gameserver.model.zone.type;
- +
- +import l2j.dev.Config;
- +import l2j.dev.gameserver.datatables.SkillTable;
- +import l2j.dev.gameserver.enums.TeleportWhereType;
- +import l2j.dev.gameserver.model.Skill;
- +import l2j.dev.gameserver.model.actor.Creature;
- +import l2j.dev.gameserver.model.actor.instance.PlayerInstance;
- +import l2j.dev.gameserver.model.zone.ZoneId;
- +import l2j.dev.gameserver.model.zone.ZoneRespawn;
- +import l2j.dev.gameserver.network.SystemMessageId;
- +import l2j.dev.gameserver.network.serverpackets.ExShowScreenMessage;
- +import l2j.dev.gameserver.taskmanager.PvpFlagTaskManager;
- +
- +/**
- + * @author Juvenil Walker
- + */
- +public class ChaoticZone extends ZoneRespawn
- +{
- + private String _ChaoticName;
- + private boolean _ChaoticNameBollean;
- + private boolean _ChaoticFlag;
- + private boolean _ChaoticNobles;
- + private boolean _Chaotic_HEAL_FUll_HP_CP_MP;
- + private int _TimeDelay;
- +
- + public ChaoticZone(int id)
- + {
- + super(id);
- + }
- +
- + @Override
- + public void setParameter(String name, String value)
- + {
- + if (name.equals("name"))
- + {
- + _ChaoticName = value;
- + }
- + else if (name.equals("ChaoticFlag"))
- + {
- + _ChaoticFlag = Boolean.parseBoolean(value);
- + }
- + else if (name.equals("ChaoticNobles"))
- + {
- + _ChaoticNobles = Boolean.parseBoolean(value);
- + }
- + else if (name.equals("Chaotic_HEAL_FUll_HP_CP_MP"))
- + {
- + _Chaotic_HEAL_FUll_HP_CP_MP = Boolean.parseBoolean(value);
- + }
- + else if (name.equals("Chaotic_HEAL_FUll_HP_CP_MP"))
- + {
- + _Chaotic_HEAL_FUll_HP_CP_MP = Boolean.parseBoolean(value);
- + }
- + else if (name.equals("ChaoticMensagem"))
- + {
- + _ChaoticNameBollean = Boolean.parseBoolean(value);
- + }
- + else if (name.equals("MensagenDelay"))
- + {
- + _TimeDelay = Integer.parseInt(value);
- + }
- + else
- + {
- + super.setParameter(name, value);
- + }
- + }
- +
- + @Override
- + protected void onEnter(Creature creature)
- + {
- + creature.setInsideZone(ZoneId.CHAOT, true);
- + creature.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
- +
- + if (creature instanceof PlayerInstance)
- + {
- + if (_ChaoticFlag)
- + {
- + ((PlayerInstance) creature).sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
- +
- + creature.updatePvPFlag(1);
- + }
- + if (_ChaoticNobles)
- + {
- + Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
- + noblesse.getEffects(creature, creature);
- + }
- +
- + if (!_Chaotic_HEAL_FUll_HP_CP_MP)
- + {
- + creature.setCurrentCp(creature.getMaxCp());
- + creature.setCurrentHp(creature.getMaxHp());
- + creature.setCurrentMp(creature.getMaxMp());
- + }
- + if (_ChaoticNameBollean)
- + {
- + creature.sendPacket(new ExShowScreenMessage(" " + getChaoticName() + "", _TimeDelay));
- + }
- +
- + }
- +
- + }
- +
- + @Override
- + protected void onExit(Creature creature)
- + {
- + creature.setInsideZone(ZoneId.CHAOT, false);
- + creature.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
- +
- + if (creature instanceof PlayerInstance)
- + {
- + if (_ChaoticFlag)
- + {
- + final PlayerInstance player = (PlayerInstance) creature;
- + PvpFlagTaskManager.getInstance().add(player, Config.PVP_NORMAL_TIME);
- + creature.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
- + ((PlayerInstance) creature).sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
- + }
- + if (_ChaoticNameBollean)
- + {
- + creature.sendPacket(new ExShowScreenMessage(" Left " + getChaoticName() + "", _TimeDelay));
- + }
- + }
- + }
- +
- + @Override
- + protected void onDieInside(Creature creature)
- + {
- + }
- +
- + @Override
- + protected void onReviveInside(Creature creature)
- + {
- + if (_Chaotic_HEAL_FUll_HP_CP_MP)
- + {
- + creature.setCurrentCp(creature.getMaxCp());
- + creature.setCurrentHp(creature.getMaxHp());
- + creature.setCurrentMp(creature.getMaxMp());
- + }
- + if (_ChaoticNobles)
- + {
- + Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
- + noblesse.getEffects(creature, creature);
- + }
- + }
- +
- + public void oustAllPlayers()
- + {
- + for (Creature creature : getCharactersInside())
- + {
- + if (creature == null)
- + {
- + continue;
- + }
- +
- + if (creature instanceof PlayerInstance)
- + {
- + final PlayerInstance player = (PlayerInstance) creature;
- + if (player.isOnline())
- + {
- + player.teleToLocation(TeleportWhereType.TOWN);
- + }
- + }
- + }
- + }
- +
- + public String getChaoticName()
- + {
- + return _ChaoticName;
- + }
- +}
- ========================================================
- Index: gameserver.datatables.xml.ZoneData.JAVA
- ========================================================
- +import l2j.dev.gameserver.model.zone.type.ChaoticZone;
- case "ArenaZone":
- {
- temp = new ArenaZone(zoneId);
- break;
- }
- + case "ChaoticZone":
- + {
- + temp = new ChaoticZone(zoneId);
- + break;
- + }
- ========================================================
- Index: l2j.dev.gameserver.datatables.xml.MapRegionData.JAVA
- ========================================================
- // Check if player is in arena.
- final ArenaZone arena = ZoneData.getInstance().getZone(player, ArenaZone.class);
- if (arena != null)
- {
- return arena.getSpawnLoc();
- }
- + // Check if player is in arena.
- + final ChaoticZone Flag = ZoneData.getInstance().getZone(player, ChaoticZone.class);
- + if (Flag != null)
- + {
- + return Flag.getSpawnLoc();
- + }
- ========================================================
- Index: GAME/DATA/ZONES/ChaoticZone.XML
- ========================================================
- +<?xml version="1.0" encoding="utf-8"?>
- +<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
- +
- + <!-- Primeval Isle -->
- + <zone type="ChaoticZone" shape="NPoly" minZ="-4290" maxZ="-1290">
- + <!-- Name Chaotic ExShowScreenMessage -->
- + <stat name="name" val="Primavel Isle" />
- + <!-- Chaotic Enable Update Flag -->
- + <stat name="ChaoticFlag" val="True" />
- + <!-- Chaotic Enable Skill Nobles -->
- + <stat name="ChaoticNobles" val="True" />
- + <!-- Chaotic Heal Full HP/CP/MP -->
- + <stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
- + <!-- Chaotic Enable Mensagem onEnter onExit -->
- + <stat name="ChaoticMensagem" val="True" />
- + <!-- Chaotic Delay Mensagen Time -->
- + <stat name="MensagenDelay" val="4000" />
- + <node X="10408" Y="-27395" />
- + <node X="12065" Y="-25334" />
- + <node X="15834" Y="-19850" />
- + <node X="8791" Y="-10223" />
- + <node X="3487" Y="-12137" />
- + <node X="4110" Y="-34245" />
- + <spawn X="10280" Y="-23832" Z="-3664" />
- + <spawn X="9496" Y="-21928" Z="-3680" />
- + </zone>
- +
- + <!-- Pagan Temple Pvp -->
- + <zone type="ChaoticZone" shape="Cylinder" minZ="-11000" maxZ="-8000" rad="19000">
- + <!-- Name Chaotic ExShowScreenMessage -->
- + <stat name="name" val="Pagan Temple" />
- + <!-- Chaotic Enable Update Flag -->
- + <stat name="ChaoticFlag" val="True" />
- + <!-- Chaotic Enable Skill Nobles -->
- + <stat name="ChaoticNobles" val="True" />
- + <!-- Chaotic Heal Full HP/CP/MP -->
- + <stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
- + <!-- Chaotic Enable Mensagem onEnter onExit -->
- + <stat name="ChaoticMensagem" val="True" />
- + <!-- Chaotic Delay Mensagen Time -->
- + <stat name="MensagenDelay" val="4000" />
- + <node X="-16370" Y="-40782" />
- + <spawn X="-17592" Y="-50776" Z="-11008" />
- + <spawn X="-15048" Y="-50712" Z="-11008" />
- + <spawn X="-17592" Y="-50776" Z="-11008" />
- + <spawn X="-15048" Y="-50712" Z="-11008" />
- + </zone>
- +
- + <!-- MONASTERY SPWAN FLAG -->
- + <zone type="ChaoticZone" shape="Cuboid" minZ="-3296" maxZ="-3392">
- + <!-- Name Chaotic ExShowScreenMessage -->
- + <stat name="name" val="Monastery" />
- + <!-- Chaotic Enable Update Flag -->
- + <stat name="ChaoticFlag" val="True" />
- + <!-- Chaotic Enable Skill Nobles -->
- + <stat name="ChaoticNobles" val="True" />
- + <!-- Chaotic Heal Full HP/CP/MP -->
- + <stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
- + <!-- Chaotic Enable Mensagem onEnter onExit -->
- + <stat name="ChaoticMensagem" val="True" />
- + <!-- Chaotic Delay Mensagen Time -->
- + <stat name="MensagenDelay" val="4000" />
- +
- + <node X="119665" Y="-77324" />
- + <node X="-118416" Y="-75408" />
- + <spawn X="148560" Y="-55904" Z="-2779" />
- + </zone>
- +
- + <!-- Ketra -->
- + <zone type="ChaoticZone" shape="Cuboid" minZ="-10000" maxZ="10000">
- + <!-- Name Chaotic ExShowScreenMessage -->
- + <stat name="name" val="Ketra Orc" />
- + <!-- Chaotic Enable Update Flag -->
- + <stat name="ChaoticFlag" val="True" />
- + <!-- Chaotic Enable Skill Nobles -->
- + <stat name="ChaoticNobles" val="True" />
- + <!-- Chaotic Heal Full HP/CP/MP -->
- + <stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
- + <!-- Chaotic Enable Mensagem onEnter onExit -->
- + <stat name="ChaoticMensagem" val="True" />
- + <!-- Chaotic Delay Mensagen Time -->
- + <stat name="MensagenDelay" val="4000" />
- +
- + <node X="137513" Y="-59681" />
- + <node X="100011" Y="-90708" />
- + <spawn X="131144" Y="-72360" Z="-3518" />
- + <spawn X="130968" Y="-71992" Z="-3489" />
- + <spawn X="130552" Y="-71768" Z="-3464" />
- + <spawn X="130088" Y="-71896" Z="-3477" />
- + <spawn X="129592" Y="-72056" Z="-3464" />
- + <spawn X="129128" Y="-72344" Z="-3487" />
- + <spawn X="129064" Y="-72856" Z="-3464" />
- + <spawn X="129560" Y="-72856" Z="-3452" />
- + <spawn X="129912" Y="-72664" Z="-3471" />
- + <spawn X="130392" Y="-72408" Z="-3508" />
- + <spawn X="130728" Y="-72584" Z="-3497" />
- + <spawn X="130712" Y="-72184" Z="-3510" />
- + <spawn X="130312" Y="-72120" Z="-3502" />
- + <spawn X="129872" Y="-72292" Z="-3503" />
- + <spawn X="129402" Y="-72557" Z="-3497" />
- + <spawn X="128824" Y="-73272" Z="-3438" />
- + <spawn X="128392" Y="-73016" Z="-3464" />
- + <spawn X="128248" Y="-73384" Z="-3405" />
- + <spawn X="127912" Y="-73016" Z="-3453" />
- + <spawn X="127688" Y="-73416" Z="-3418" />
- + <spawn X="127400" Y="-73176" Z="-3384" />
- + <spawn X="127016" Y="-73608" Z="-3384" />
- + <spawn X="126904" Y="-72984" Z="-3272" />
- + <spawn X="126488" Y="-72552" Z="-3208" />
- + <spawn X="126088" Y="-72264" Z="-3161" />
- + <spawn X="126024" Y="-71880" Z="-3105" />
- + <spawn X="127080" Y="-74184" Z="-3265" />
- + <spawn X="127048" Y="-74728" Z="-3109" />
- + <spawn X="126632" Y="-75080" Z="-2997" />
- + <spawn X="126584" Y="-75384" Z="-2887" />
- + <spawn X="126296" Y="-75544" Z="-2857" />
- + <spawn X="126120" Y="-75688" Z="-2852" />
- + <spawn X="127144" Y="-73304" Z="-3368" />
- + <spawn X="128696" Y="-73048" Z="-3446" />
- + <spawn X="128088" Y="-71944" Z="-2824" />
- + <spawn X="126920" Y="-71736" Z="-2816" />
- + <spawn X="128168" Y="-71880" Z="-2848" />
- + <spawn X="129016" Y="-71080" Z="-2824" />
- + <spawn X="130440" Y="-73432" Z="-2904" />
- + <spawn X="127928" Y="-74488" Z="-2608" />
- + </zone>
- +
- + <!-- Imperial Tomb -->
- + <zone type="ChaoticZone" shape="Cuboid" minZ="-10000" maxZ="10000">
- + <!-- Name Chaotic ExShowScreenMessage -->
- + <stat name="name" val="Imperial Tomb" />
- + <!-- Chaotic Enable Update Flag -->
- + <stat name="ChaoticFlag" val="True" />
- + <!-- Chaotic Enable Skill Nobles -->
- + <stat name="ChaoticNobles" val="True" />
- + <!-- Chaotic Heal Full HP/CP/MP -->
- + <stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
- + <!-- Chaotic Enable Mensagem onEnter onExit -->
- + <stat name="ChaoticMensagem" val="True" />
- + <!-- Chaotic Delay Mensagen Time -->
- + <stat name="MensagenDelay" val="4000" />
- +
- + <node X="197805" Y="-67585" />
- + <node X="173512" Y="-91135" />
- + <spawn X="180408" Y="-78696" Z="-2728" />
- + <spawn X="182440" Y="-78696" Z="-2728" />
- + <spawn X="181384" Y="-79688" Z="-2728" />
- + <spawn X="181416" Y="-77576" Z="-2728" />
- + <spawn X="181288" Y="-78584" Z="-2728" />
- + <spawn X="181336" Y="-78776" Z="-2728" />
- + <spawn X="181512" Y="-78696" Z="-2728" />
- + <spawn X="181480" Y="-78520" Z="-2727" />
- + <spawn X="181992" Y="-78680" Z="-2728" />
- + <spawn X="181368" Y="-79256" Z="-2728" />
- + <spawn X="180904" Y="-78696" Z="-2728" />
- + <spawn X="180200" Y="-78168" Z="-2731" />
- + <spawn X="180248" Y="-79240" Z="-2729" />
- + <spawn X="180872" Y="-79944" Z="-2731" />
- + <spawn X="181944" Y="-79960" Z="-2731" />
- + <spawn X="182664" Y="-79208" Z="-2728" />
- + <spawn X="182648" Y="-78104" Z="-2728" />
- + <spawn X="182088" Y="-77448" Z="-2731" />
- + <spawn X="180856" Y="-77448" Z="-2731" />
- + <spawn X="181384" Y="-77960" Z="-2728" />
- + </zone>
- +</list>
Add Comment
Please, Sign In to add comment