Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Reunion_Core
- Index: java/l2r/gameserver/GameServer.java
- ===================================================================
- --- java/l2r/gameserver/GameServer.java (revision 1174)
- +++ java/l2r/gameserver/GameServer.java (working copy)
- @@ -128,6 +128,7 @@
- import l2r.gameserver.model.entity.Hero;
- import l2r.gameserver.model.entity.olympiad.Olympiad;
- import l2r.gameserver.model.events.EventDispatcher;
- +import l2r.gameserver.model.zone.type.L2SoloZone;
- import l2r.gameserver.network.L2GameClient;
- import l2r.gameserver.network.L2GamePacketHandler;
- import l2r.gameserver.pathfinding.PathFinding;
- @@ -405,6 +406,8 @@
- _log.info("BattleField Zone Initialized.");
- }
- + L2SoloZone.StartScheduler();
- +
- printSection("Elemental");
- // Auction House Manager
- AuctionHouseManager.getInstance();
- Index: java/l2r/gameserver/model/zone/type/L2SoloZone.java
- ===================================================================
- --- java/l2r/gameserver/model/zone/type/L2SoloZone.java (revision 0)
- +++ java/l2r/gameserver/model/zone/type/L2SoloZone.java (working copy)
- @@ -0,0 +1,153 @@
- +/*
- + * 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 l2r.gameserver.model.zone.type;
- +
- +import l2r.gameserver.ThreadPoolManager;
- +import l2r.gameserver.datatables.xml.SkillData;
- +import l2r.gameserver.enums.ZoneIdType;
- +import l2r.gameserver.model.actor.L2Character;
- +import l2r.gameserver.model.actor.instance.L2PcInstance;
- +import l2r.gameserver.model.zone.L2ZoneType;
- +import l2r.gameserver.network.clientpackets.Say2;
- +import l2r.gameserver.network.serverpackets.CreatureSay;
- +import l2r.gameserver.util.Broadcast;
- +
- +/**
- + * @author -=DoctorNvm=-
- + */
- +public class L2SoloZone extends L2ZoneType
- +{
- + private static boolean is_active = false;
- +
- + private static int first_delay = 10; // minutes
- + private static int solo_match_time = 20; // minutes
- + private static int delay_between_solo = 40; // minutes
- +
- + public L2SoloZone(int id)
- + {
- + super(id);
- + }
- +
- + @Override
- + protected void onEnter(L2Character character)
- + {
- + L2PcInstance activeChar = character.getActingPlayer();
- + if (isSoloActive())
- + {
- + if (character.isPlayer())
- + {
- + character.setInsideZone(ZoneIdType.SOLO, true);
- + character.setInsideZone(ZoneIdType.PEACE, false);
- + character.setInsideZone(ZoneIdType.NO_RESTART, true);
- + character.setInsideZone(ZoneIdType.NO_SUMMON_FRIEND, true);
- + character.setInsideZone(ZoneIdType.NO_STORE, true);
- + character.setInsideZone(ZoneIdType.NO_BOOKMARK, true);
- + character.setInsideZone(ZoneIdType.NO_ITEM_DROP, true);
- +
- + activeChar.startAntifeedProtection(true, true); // start antifeed protection
- +
- + SkillData.getInstance().getInfo(1323, 1).getEffects(character, character);
- + ((L2PcInstance) character).setPvpFlag(1);
- + ((L2PcInstance) character).broadcastUserInfo();
- + }
- + }
- + else
- + {
- + activeChar.teleToLocation(52345, 3453, 53452); // teleport in main town if solos is disabled
- + }
- + }
- +
- + @Override
- + protected void onExit(final L2Character character)
- + {
- + if (character.isPlayer())
- + {
- + character.setInsideZone(ZoneIdType.SOLO, false);
- + character.setInsideZone(ZoneIdType.NO_RESTART, false);
- + character.setInsideZone(ZoneIdType.NO_SUMMON_FRIEND, false);
- + character.setInsideZone(ZoneIdType.NO_STORE, false);
- + character.setInsideZone(ZoneIdType.NO_BOOKMARK, false);
- + character.setInsideZone(ZoneIdType.NO_ITEM_DROP, false);
- + ((L2PcInstance) character)._fireZoneDeflagTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
- + {
- + ((L2PcInstance) character).setPvpFlag(0);
- + ((L2PcInstance) character).broadcastUserInfo();
- + }, 30 * 1000);
- + }
- + }
- +
- + @Override
- + public void onReviveInside(L2Character character)
- + {
- + if (isSoloActive())
- + {
- + L2PcInstance activeChar = character.getActingPlayer();
- + SkillData.getInstance().getInfo(1323, 1).getEffects(activeChar, activeChar);
- + activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
- + activeChar.setCurrentCp(activeChar.getMaxCp());
- +
- + if (activeChar.hasSummon())
- + {
- + SkillData.getInstance().getInfo(1323, 1).getEffects(activeChar, activeChar.getSummon());
- + activeChar.getSummon().setCurrentHp(activeChar.getSummon().getMaxHp());
- + }
- + }
- + }
- +
- + public static void StartScheduler()
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(() ->
- + {
- + setIsSoloActive(true);
- + Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is started for next 20 minutes."));
- + runningTime();
- + }, first_delay * 10000);
- + }
- +
- + public static void runningTime()
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(() ->
- + {
- + setIsSoloActive(false);
- + Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is finished. Next match in " + delay_between_solo + " minutes."));
- + // activeChar.teleToLocation(52345, 3453, 53452); // teleport again inside the zone to make him leave
- + nextOrganizedSchedule();
- + }, solo_match_time * 10000);
- + }
- +
- + public static void nextOrganizedSchedule()
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(() ->
- + {
- + Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is about to begin in 10 minutes."));
- + }, (delay_between_solo - 10) * 10000);
- +
- + ThreadPoolManager.getInstance().scheduleGeneral(() ->
- + {
- + Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is finished. Next match in " + delay_between_solo + " minutes."));
- + StartScheduler();
- + }, (delay_between_solo - first_delay) * 10000);
- + }
- +
- + public static boolean isSoloActive()
- + {
- + return is_active;
- + }
- +
- + public static void setIsSoloActive(boolean x)
- + {
- + is_active = x;
- + }
- +}
- \ No newline at end of file
- Index: java/l2r/gameserver/enums/ZoneIdType.java
- ===================================================================
- --- java/l2r/gameserver/enums/ZoneIdType.java (revision 1174)
- +++ java/l2r/gameserver/enums/ZoneIdType.java (working copy)
- @@ -52,7 +52,8 @@
- FLAG,
- FIRE1,
- FIRE2,
- - FIRE3;
- + FIRE3,
- + SOLO;
- public static int getZoneCount()
- {
Advertisement
Add Comment
Please, Sign In to add comment