- diff --git a/aCis/config/events.properties b/aCis/config/events.properties
- index fa6fd85..75c9cab 100644
- --- a/aCis/config/events.properties
- +++ b/aCis/config/events.properties
- @@ -1,4 +1,38 @@
- #=============================================================
- +# Party Farm Event
- +#=============================================================
- +
- +# Enable Zone Party Farm.
- +PartyFarmEnable = True
- +
- +# Times Party Farm will occur (24h format). Example : 18:00;19:00;20:00
- +PartyFarmTime = 16:03
- +
- +# Running Party Zone Farm.
- +PartyFarmRunningTime = 3
- +
- +# Party Farm Monster Id and Spawn monsters. Configure spawn locX,locY,locZ;locX,locY,locZ;
- +PartyFarmMonsterId = 50004
- +PartyFarmMonsterLoc = 81304,-14904,-1824;\
- +81464,-14856,-1824;\
- +81704,-14524,-1824;\
- +82184,-15224,-1856;\
- +82648,-15432,-1880;\
- +83155,-15336,-1856;\
- +83532,-15276,-1826;\
- +85222,-16135,-1824;\
- +84808,-15864,-1824;\
- +84632,-16088,-1824;\
- +84424,-15720,-1824;\
- +84088,-15528,-1824;\
- +83624,-15272,-1824;\
- +83480,-15016,-1824;\
- +83099,-14955,-1824;\
- +82680,-15000,-1832;\
- +82376,-15112,-1856;\
- +81992,-15208,-1840;\
- +
- +#=============================================================
- # Olympiad
- #=============================================================
- # Olympiad start time hour, default 18 (6PM).
- diff --git a/aCis/data/xml/teleports.xml b/aCis/data/xml/teleports.xml
- index 0b69d05..aa3163c 100644
- --- a/aCis/data/xml/teleports.xml
- +++ b/aCis/data/xml/teleports.xml
- @@ -85,7 +85,8 @@
- <loc desc="The Heart of Antharas' Lair" type="NOBLE_HUNTING_ZONE_ADENA" priceId="57" priceCount="1000" x="154396" y="121235" z="-3808" />
- <loc desc="The Center of Dragon Valley" type="NOBLE_HUNTING_ZONE_ADENA" priceId="57" priceCount="1000" x="122824" y="110836" z="-3727" />
- <loc desc="Hardin's Private Academy" type="NOBLE_HUNTING_ZONE_ADENA" priceId="57" priceCount="1000" x="105918" y="109759" z="-3170" />
- - <loc desc="Coliseum" type="NOBLE_HUNTING_ZONE_ADENA" priceId="57" priceCount="1000" x="146440" y="46723" z="-3400" />
- + <loc desc="Coliseum" type="NOBLE_HUNTING_ZONE_ADENA" priceId="57" priceCount="1000" x="146440" y="46723" z="-3400" />
- + <loc desc="Party Zone" type="STANDARD" priceId="57" priceCount="10000" x="81096" y="-15437" z="-1800" isParty="true"/>
- </telPosList>
- <telPosList npcId="30134">
- <loc desc="The Town of Gludio" type="STANDARD" priceId="57" priceCount="10000" x="-12694" y="122776" z="-3114" castleId="1" />
- diff --git a/aCis/data/xml/zones/PartyZone.xml b/aCis/data/xml/zones/PartyZone.xml
- new file mode 100644
- index 0000000..3a899a1
- --- /dev/null
- +++ b/aCis/data/xml/zones/PartyZone.xml
- @@ -0,0 +1,13 @@
- +<?xml version="1.0" encoding="UTF-8"?>
- +<list>
- + <zone id="1" shape="NPoly" minZ="-2920" maxZ="80"><!-- bandits_stronghold -->
- + <stat name="reviveDelay" val="5" />
- + <stat name="isFlag" val="false" />
- + <node x="79028" y="-17588" />
- + <node x="84640" y="-19528" />
- + <node x="86952" y="-16888" />
- + <node x="83636" y="-13448" />
- + <node x="79196" y="-13584" />
- + <spawn type="NORMAL" x="81096" y="-15437" z="-1800"/>
- + </zone>
- +</list>
- \ No newline at end of file
- diff --git a/aCis/java/net/sf/l2j/Config.java b/aCis/java/net/sf/l2j/Config.java
- index cfaa253..3a5f558 100644
- --- a/aCis/java/net/sf/l2j/Config.java
- +++ b/aCis/java/net/sf/l2j/Config.java
- @@ -123,6 +123,13 @@
- // --------------------------------------------------
- // Events settings
- // --------------------------------------------------
- +
- + /** Pasrty Zone*/
- + public static boolean PARTY_ZONE_ENABLE;
- + public static int PARTY_ZONE_RUNNING_TIME;
- + public static List<Location> PARTY_ZONE_LOCS = new ArrayList<>();
- + public static int PARTY_MONSTER_ID;
- /** Olympiad */
- public static int OLY_START_TIME;
- @@ -916,15 +924,15 @@
- {
- final ExProperties events = initProperties(EVENTS_FILE);
- + PARTY_ZONE_ENABLE = events.getProperty("PartyFarmEnable", false);
- + PARTY_ZONE_TIME = events.getProperty("PartyFarmTime", "15:50").split(";");
- + PARTY_ZONE_RUNNING_TIME = events.getProperty("PartyFarmRunningTime", 5);
- + PARTY_MONSTER_ID = events.getProperty("PartyFarmMonsterId", 5);
- + {
- + }
- OLY_START_TIME = events.getProperty("OlyStartTime", 18);
- OLY_MIN = events.getProperty("OlyMin", 0);
- diff --git a/aCis/java/net/sf/l2j/gameserver/GameServer.java b/aCis/java/net/sf/l2j/gameserver/GameServer.java
- index 5a897a1..3cabaac 100644
- --- a/aCis/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/aCis/java/net/sf/l2j/gameserver/GameServer.java
- @@ -100,6 +100,7 @@
- import net.sf.l2j.gameserver.model.boat.BoatInnadrilTour;
- import net.sf.l2j.gameserver.model.boat.BoatRunePrimeval;
- import net.sf.l2j.gameserver.model.boat.BoatTalkingGludin;
- +import net.sf.l2j.gameserver.model.entity.PartyEvent;
- import net.sf.l2j.gameserver.model.entity.engine.EventManager;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
- @@ -316,6 +317,7 @@
- StringUtil.printSection("Events");
- DerbyTrackManager.getInstance();
- LotteryManager.getInstance();
- + PartyEvent.getInstance();
- EventManager.getInstance();
- TournamentManager.getInstance();
- diff --git a/aCis/java/net/sf/l2j/gameserver/enums/ZoneId.java b/aCis/java/net/sf/l2j/gameserver/enums/ZoneId.java
- index fa282c1..03b7164 100644
- --- a/aCis/java/net/sf/l2j/gameserver/enums/ZoneId.java
- +++ b/aCis/java/net/sf/l2j/gameserver/enums/ZoneId.java
- @@ -22,7 +22,8 @@
- NO_RESTART(17),
- SCRIPT(18),
- BOSS(19),
- - MULTI(20);
- + MULTI(20),
- + PARTY(21);
- private final int _id;
- diff --git a/aCis/java/net/sf/l2j/gameserver/model/actor/Npc.java b/aCis/java/net/sf/l2j/gameserver/model/actor/Npc.java
- index 4e1c12a..d9ffae4 100644
- --- a/aCis/java/net/sf/l2j/gameserver/model/actor/Npc.java
- +++ b/aCis/java/net/sf/l2j/gameserver/model/actor/Npc.java
- @@ -940,7 +940,14 @@
- return;
- }
- }
- -
- +
- + // The list is for party, but player isn't party.
- + if (teleport.isParty() && !player.isInParty())
- + {
- + player.sendMessage("You are not currently on party.");
- + return;
- + }
- +
- if (Config.FREE_TELEPORT || teleport.getPriceCount() == 0 || player.destroyItemByItemId("InstantTeleport", teleport.getPriceId(), Config.VIP_REDUCE_PRICE > 0 && (player.isVip()) ? teleport.getPriceCount() / Config.VIP_REDUCE_PRICE : teleport.getPriceCount(), this, true))
- player.teleportTo(teleport, 20);
- diff --git a/aCis/java/net/sf/l2j/gameserver/model/actor/Playable.java b/aCis/java/net/sf/l2j/gameserver/model/actor/Playable.java
- index f34a91e..c706707 100644
- --- a/aCis/java/net/sf/l2j/gameserver/model/actor/Playable.java
- +++ b/aCis/java/net/sf/l2j/gameserver/model/actor/Playable.java
- @@ -27,6 +27,7 @@
- import net.sf.l2j.gameserver.model.item.kind.EtcItem;
- import net.sf.l2j.gameserver.model.pledge.Clan;
- import net.sf.l2j.gameserver.model.zone.type.MultiZone;
- +import net.sf.l2j.gameserver.model.zone.type.PartyZone;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ExUseSharedGroupItem;
- import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- @@ -132,6 +133,10 @@
- final MultiZone multi = ZoneManager.getInstance().getZone(this, MultiZone.class);
- if (multi != null)
- multi.onDie(this);
- +
- + final PartyZone party = ZoneManager.getInstance().getZone(this, PartyZone.class);
- + if (party != null)
- + party.onDie(this);
- // Notify Quest of Playable's death
- final Player actingPlayer = getActingPlayer();
- @@ -167,6 +172,10 @@
- final MultiZone multi = ZoneManager.getInstance().getZone(this, MultiZone.class);
- if (multi != null)
- multi.onRevive(this);
- +
- + final PartyZone party = ZoneManager.getInstance().getZone(this, PartyZone.class);
- + if (party != null)
- + party.onRevive(this);
- // Start broadcast status
- broadcastPacket(new Revive(this));
- diff --git a/aCis/java/net/sf/l2j/gameserver/model/entity/PartyEvent.java b/aCis/java/net/sf/l2j/gameserver/model/entity/PartyEvent.java
- new file mode 100644
- index 0000000..f10e4ec
- --- /dev/null
- +++ b/aCis/java/net/sf/l2j/gameserver/model/entity/PartyEvent.java
- @@ -0,0 +1,171 @@
- +package net.sf.l2j.gameserver.model.entity;
- +
- +import java.util.ArrayList;
- +import java.util.Calendar;
- +import java.util.List;
- +
- +import net.sf.l2j.commons.logging.CLogger;
- +import net.sf.l2j.commons.pool.ThreadPool;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.manager.ZoneManager;
- +import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType;
- +import net.sf.l2j.gameserver.data.xml.NpcData;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Creature;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.location.Location;
- +import net.sf.l2j.gameserver.model.spawn.Spawn;
- +import net.sf.l2j.gameserver.model.zone.type.PartyZone;
- +
- +/**
- + * @author Williams
- + *
- + */
- +{
- + private static final CLogger LOGGER = new CLogger(PartyEvent.class.getName());
- +
- + private static final PartyZone PARTY_ZONE = ZoneManager.getInstance().getZoneById(1, PartyZone.class);
- +
- + public enum States
- + {
- + AWAITING,
- + ACTIVE,
- + INACTIVE;
- + }
- +
- + private States _state;
- + private int _tick;
- +
- + private List<Npc> _monsters = new ArrayList<>();
- +
- + public PartyEvent()
- + {
- + if (Config.PARTY_ZONE_ENABLE)
- + {
- + _state = States.AWAITING;
- + ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
- + LOGGER.info("Party Farm: Event is active.");
- + }
- + else
- + {
- + _state = States.INACTIVE;
- + LOGGER.info("Party Farm: Event is disabled.");
- + }
- + }
- +
- + @Override
- + public void run()
- + {
- + if (_state == States.AWAITING)
- + {
- +
- + {
- + startEvent();
- + }
- + }
- + else if (_state == States.ACTIVE)
- + {
- + switch (_tick)
- + {
- + case 3600: // 60 minutes left
- + case 1800: // 30 minutes left
- + case 600: // 15 minutes left
- + case 900: // 10 minutes left
- + case 300: // 5 minutes left
- + case 240: // 4 minutes left
- + case 180: // 3 minutes left
- + case 120: // 2 minutes left
- + case 60: // 1 minute left
- + World.announceToOnlinePlayers("Party Farm: " + (_tick / 60) + " minute(s) until the Party Farm event is finished!", true);
- + break;
- + case 30: // 30 seconds left
- + case 15: // 15 seconds left
- + case 3: // 3 seconds left
- + case 2: // 2 seconds left
- + case 1: // 1 seconds left
- + World.announceToOnlinePlayers("Party Farm: " + _tick + " second(s) until the Party Farm event is finished!", true);
- + break;
- + }
- +
- + if (_tick == 0)
- + endEvent();
- +
- + _tick--;
- + }
- + }
- +
- + public void startEvent()
- + {
- + _state = States.ACTIVE;
- +
- + // spawn monsters
- + Config.PARTY_ZONE_LOCS.forEach(loc -> spawnMonsters(Config.PARTY_MONSTER_ID, loc));
- + World.announceToOnlinePlayers("Party Farm: event enabled, go to the gatekeeper to teleport.", true);
- + _tick = Config.PARTY_ZONE_RUNNING_TIME * 60;
- + }
- +
- + private Npc spawnMonsters(int npcId, Location loc)
- + {
- + Npc ret = null;
- + final NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
- + try
- + {
- + final Spawn spawn = new Spawn(template);
- + spawn.setLoc(loc.getX(), loc.getY(), loc.getZ(), 0);
- + spawn.setRespawnDelay(60);
- + spawn.setRespawnState(true);
- + ret = spawn.doSpawn(false);
- + }
- + {
- + LOGGER.warn("Party Farm: Unable to spawn npc with id " + npcId + ".");
- + }
- +
- + if (ret != null)
- + _monsters.add(ret);
- +
- + return ret;
- + }
- +
- + public void endEvent()
- + {
- + _state = States.INACTIVE;
- +
- + World.announceToOnlinePlayers("Party Farm: event finish, thank you for participating.", true);
- +
- + // Remove all participants from the zone
- + for (Creature cha : PARTY_ZONE.getKnownTypeInside(Player.class))
- + cha.teleportTo(TeleportType.TOWN);
- +
- + // Remove all monsters from the zone
- + for (Npc npc : _monsters)
- + {
- + final Spawn spawn = npc.getSpawn();
- + if (spawn != null)
- + spawn.setRespawnState(false);
- +
- + npc.deleteMe();
- + }
- + _monsters.clear();
- + }
- +
- + public static PartyEvent getInstance()
- + {
- + return SingletonHolder.INSTANCE;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final PartyEvent INSTANCE = new PartyEvent();
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis/java/net/sf/l2j/gameserver/model/location/Teleport.java b/aCis/java/net/sf/l2j/gameserver/model/location/Teleport.java
- index a2bafe7..5006984 100644
- --- a/aCis/java/net/sf/l2j/gameserver/model/location/Teleport.java
- +++ b/aCis/java/net/sf/l2j/gameserver/model/location/Teleport.java
- @@ -20,6 +20,7 @@
- private final int _priceId;
- private final int _priceCount;
- private final int _castleId;
- + private final boolean _isParty;
- public Teleport(StatSet set)
- {
- @@ -30,6 +31,7 @@
- _priceId = set.getInteger("priceId");
- _priceCount = set.getInteger("priceCount");
- _castleId = set.getInteger("castleId", 0);
- + _isParty = set.getBool("isParty", false);
- }
- @Override
- @@ -63,6 +65,11 @@
- return _castleId;
- }
- + public boolean isParty()
- + {
- + return _isParty;
- + }
- +
- /**
- * In L2OFF half price teleport feature is set in 'event.ini' and is named 'CoreTime'.<br>
- * However some custom/extended L2OFF packs are likely to use type "PRIMEHOURS", but it is nothing more than static data duplication.<br>
- diff --git a/aCis/java/net/sf/l2j/gameserver/model/zone/type/PartyZone.java b/aCis/java/net/sf/l2j/gameserver/model/zone/type/PartyZone.java
- new file mode 100644
- index 0000000..d70f578
- --- /dev/null
- +++ b/aCis/java/net/sf/l2j/gameserver/model/zone/type/PartyZone.java
- @@ -0,0 +1,129 @@
- +package net.sf.l2j.gameserver.model.zone.type;
- +
- +import net.sf.l2j.commons.pool.ThreadPool;
- +
- +import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType;
- +import net.sf.l2j.gameserver.enums.SpawnType;
- +import net.sf.l2j.gameserver.enums.ZoneId;
- +import net.sf.l2j.gameserver.model.actor.Creature;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.Summon;
- +import net.sf.l2j.gameserver.model.zone.type.subtype.SpawnZoneType;
- +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
- +
- +/**
- + * @author Williams
- + *
- + */
- +public class PartyZone extends SpawnZoneType
- +{
- + private int _reviveDelay;
- + private boolean _isFlag;
- +
- + public PartyZone(int id)
- + {
- + super(id);
- + }
- +
- + @Override
- + {
- + if (name.equals("reviveDelay"))
- + else if (name.equals("isFlag"))
- + else
- + super.setParameter(name, value);
- + }
- +
- + @Override
- + protected void onEnter(Creature character)
- + {
- + character.setInsideZone(ZoneId.NO_STORE, true);
- + character.setInsideZone(ZoneId.PARTY, true);
- +
- + if (character instanceof Player)
- + {
- + final Player player = (Player) character;
- +
- + // Add Flag
- + if (_isFlag)
- + {
- + player.updatePvPFlag(1);
- + return;
- + }
- +
- + if (!player.isInParty())
- + {
- + player.sendMessage("You are not currently on party.");
- + player.teleportTo(TeleportType.TOWN);
- + return;
- + }
- + }
- + }
- +
- + @Override
- + protected void onExit(Creature character)
- + {
- + character.setInsideZone(ZoneId.PARTY, false);
- + character.setInsideZone(ZoneId.NO_STORE, false);
- +
- + if (character instanceof Player)
- + {
- + final Player player = (Player) character;
- + if (_isFlag)
- + {
- + player.updatePvPFlag(0);
- + return;
- + }
- + }
- + }
- +
- + public void onDie(Creature character)
- + {
- + if (_reviveDelay > 0)
- + {
- + ThreadPool.schedule(() -> respawnCharacter(character), _reviveDelay * 1000);
- + character.sendPacket(new ExShowScreenMessage("You will be revived in " + _reviveDelay + " second(s).", 5000));
- + }
- + }
- +
- + public void onRevive(Creature character)
- + {
- + if (_reviveDelay > 0)
- + {
- + if (character instanceof Player)
- + {
- + final Player player = (Player) character;
- + final Summon pet = player.getSummon();
- + if (pet != null)
- + pet.getStatus().setMaxHpMp();
- +
- + player.getStatus().setMaxCpHpMp();
- + }
- + }
- + }
- +
- + private void respawnCharacter(Creature character)
- + {
- + if (character instanceof Player)
- + {
- + final Player player = (Player) character;
- + if (player.isDead())
- + {
- + player.doRevive();
- + player.teleportTo(getRndSpawn((player.getKarma() > 0) ? SpawnType.CHAOTIC : SpawnType.NORMAL), 20);
- + }
- + }
- + }
- +
- + public boolean isFlag()
- + {
- + return _isFlag;
- + }
- +
- + public int getRevive()
- + {
- + return _reviveDelay;
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis/java/net/sf/l2j/gameserver/network/serverpackets/Die.java b/aCis/java/net/sf/l2j/gameserver/network/serverpackets/Die.java
- index 6aaf651..efd1fa8 100644
- --- a/aCis/java/net/sf/l2j/gameserver/network/serverpackets/Die.java
- +++ b/aCis/java/net/sf/l2j/gameserver/network/serverpackets/Die.java
- @@ -10,6 +10,7 @@
- import net.sf.l2j.gameserver.model.entity.engine.EventListener;
- import net.sf.l2j.gameserver.model.pledge.Clan;
- import net.sf.l2j.gameserver.model.zone.type.MultiZone;
- +import net.sf.l2j.gameserver.model.zone.type.PartyZone;
- public class Die extends L2GameServerPacket
- {
- @@ -17,6 +18,7 @@
- private final int _objectId;
- private final boolean _fake;
- private boolean _isReviveZone;
- + private boolean _isRevivePartyZone;
- private boolean _event;
- private boolean _sweepable;
- @@ -35,6 +37,10 @@
- _allowFixedRes = player.getAccessLevel().allowFixedRes();
- _clan = player.getClan();
- + final PartyZone party = ZoneManager.getInstance().getZone(player, PartyZone.class);
- + if (party != null)
- + _isRevivePartyZone = party.getRevive() != 0;
- +
- final MultiZone multi = ZoneManager.getInstance().getZone(player, MultiZone.class);
- if (multi != null)
- _isReviveZone = multi.getReviveDelay() != 0;
- @@ -53,7 +59,7 @@
- writeC(0x06);
- writeD(_objectId);
- - writeD(_event ? 0x00 : _isReviveZone ? 0x00 : 0x01); // to nearest village
- + writeD(_isRevivePartyZone ? 0x00 : _event ? 0x00 : _isReviveZone ? 0x00 : 0x01); // to nearest village
- if (_clan != null)
- {
- diff --git a/aCis/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java b/aCis/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- index 7ed5619..c73dacd 100644
- --- a/aCis/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- +++ b/aCis/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- @@ -9,6 +9,7 @@
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.zone.type.BossZone;
- import net.sf.l2j.gameserver.model.zone.type.MultiZone;
- +import net.sf.l2j.gameserver.model.zone.type.PartyZone;
- /**
- * Update and clear PvP flag of {@link Player}s after specified time.
- @@ -53,7 +54,14 @@
- _players.remove(player);
- continue;
- }
- -
- +
- + final PartyZone party = ZoneManager.getInstance().getZone(player, PartyZone.class);
- + if (party != null && party.isFlag())
- + {
- + _players.remove(player);
- + continue;
- + }
- +
- // Time is running out, clear PvP flag and remove from list.
- if (currentTime > timeLeft)
- remove(player, true);
Recent Pastes