Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- com.l2jfrozen.gameserver.model.zone.type.L2PartyZone.java
- =========================================================
- /*
- * 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 com.l2jfrozen.gameserver.model.zone.type;
- import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
- import com.l2jfrozen.gameserver.model.L2Character;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
- public class L2PartyZone extends L2ZoneType
- {
- /**
- * @param id
- */
- public L2PartyZone(int id)
- {
- super(id);
- }
- @Override
- protected void onEnter(L2Character character)
- {
- if (character instanceof L2PcInstance)
- {
- if(((L2PcInstance) character).getParty() != null)
- {
- ((L2PcInstance) character).setIsInsidePartyZone(true);
- ((L2PcInstance) character).sendMessage("You have entered a Party Zone. Prepare for fight.");
- }
- else
- {
- ((L2PcInstance) character).sendMessage("This is strict area for Party members ONLY. You will be teleported at the nearest town.");
- ((L2PcInstance) character).teleToLocation(MapRegionTable.TeleportWhereType.Town);
- }
- }
- }
- @Override
- protected void onExit(L2Character character)
- {
- if (character instanceof L2PcInstance)
- {
- ((L2PcInstance) character).setIsInsidePartyZone(false);
- }
- }
- @Override
- public void onDieInside(L2Character character)
- {
- }
- @Override
- public void onReviveInside(L2Character character)
- {
- onEnter(character);
- }
- }
- =====================================================================
- com.l2jfrozen.gameserver.model.L2Character.java
- ====================================================================
- /** The Constant ZONE_PARTYZONE. */
- public static final int ZONE_PARTYZONE = 16386;
- /**
- * @return the _isInsidePartyZone
- */
- public boolean isInsidePartyZone()
- {
- return isInsidePartyZone();
- }
- /**
- * @param _isInsidePartyZone the _isInsidePartyZone to set
- */
- public void setIsInsidePartyZone(boolean _isInsidePartyZone)
- {
- this._isInPartyZone = _isInsidePartyZone;
- }
- ======================================================
- ZoneData.java
- ======================================================
- import com.l2jfrozen.gameserver.model.zone.type.L2PartyZone;
- case "PartyZone":
- temp = new L2PartyZone(zoneId);
- break;
- }
- ==============================================
- com.l2jfrozen.gameserver.network.serverpackets.Die.java
- ==============================================
- com.l2jfrozen.gameserver.model.zone.type.L2PartyZone
- (player.isInsideZone(L2Character.ZONE_PARTYZONE) && player.isPendingRevive()));
- =================================================
- com.l2jfrozen.gameserver.model.L2Party.java
- =================================================
- public void removePartyMember(final String name)
- {
- final L2PcInstance player = getPlayerByName(name);
- if (player != null)
- removePartyMember(player);
- if (player.isInsidePartyZone())
- {
- if (getMemberCount() < 5)
- {
- getPartyMembers().forEach(s -> s.teleToLocation(MapRegionTable.TeleportWhereType.Town));
- }
- }
- }
Add Comment
Please, Sign In to add comment