Proper support for hunting teleports.
This commit is contained in:
		| @@ -22,6 +22,7 @@ package com.l2jmobius.gameserver.enums; | ||||
| public enum TeleportType | ||||
| { | ||||
| 	NORMAL, | ||||
| 	HUNTING, | ||||
| 	NOBLES_TOKEN, | ||||
| 	NOBLES_ADENA, | ||||
| 	OTHER; | ||||
|   | ||||
| @@ -91,6 +91,18 @@ public final class L2TeleporterInstance extends L2Npc | ||||
| 				holder.showTeleportList(player, this); | ||||
| 				break; | ||||
| 			} | ||||
| 			case "showTeleportsHunting": | ||||
| 			{ | ||||
| 				final String listName = (st.hasMoreTokens()) ? st.nextToken() : TeleportType.HUNTING.name(); | ||||
| 				final TeleportHolder holder = TeleportersData.getInstance().getHolder(getId(), listName); | ||||
| 				if (holder == null) | ||||
| 				{ | ||||
| 					LOGGER.warning("Player " + player.getObjectId() + " requested show teleports for hunting list with name " + listName + " at NPC " + getId() + "!"); | ||||
| 					return; | ||||
| 				} | ||||
| 				holder.showTeleportList(player, this); | ||||
| 				break; | ||||
| 			} | ||||
| 			case "teleport": | ||||
| 			{ | ||||
| 				// Check for required count of params. | ||||
|   | ||||
| @@ -75,7 +75,7 @@ public final class TeleportHolder | ||||
| 	 */ | ||||
| 	public boolean isNoblesse() | ||||
| 	{ | ||||
| 		return _type == TeleportType.NOBLES_ADENA || _type == TeleportType.NOBLES_TOKEN; | ||||
| 		return (_type == TeleportType.NOBLES_ADENA) || (_type == TeleportType.NOBLES_TOKEN); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| @@ -140,7 +140,7 @@ public final class TeleportHolder | ||||
| 		} | ||||
| 		 | ||||
| 		// Load variables | ||||
| 		final int questZoneId = (_type == TeleportType.NORMAL) ? player.getQuestZoneId() : -1; | ||||
| 		final int questZoneId = isNormalTeleport() ? player.getQuestZoneId() : -1; | ||||
| 		 | ||||
| 		// Build html | ||||
| 		final StringBuilder sb = new StringBuilder(); | ||||
| @@ -216,7 +216,7 @@ public final class TeleportHolder | ||||
| 		} | ||||
| 		 | ||||
| 		// Validate conditions for NORMAL teleport | ||||
| 		if (_type == TeleportType.NORMAL) | ||||
| 		if (isNormalTeleport()) | ||||
| 		{ | ||||
| 			if (npc.getCastle().getSiege().isInProgress()) | ||||
| 			{ | ||||
| @@ -270,7 +270,7 @@ public final class TeleportHolder | ||||
| 	 */ | ||||
| 	private boolean shouldPayFee(L2PcInstance player, TeleportLocation loc) | ||||
| 	{ | ||||
| 		return (_type != TeleportType.NORMAL) || (((player.getLevel() > Config.MAX_FREE_TELEPORT_LEVEL) || player.isSubClassActive()) && ((loc.getFeeId() != 0) && (loc.getFeeCount() > 0))); | ||||
| 		return !isNormalTeleport() || (((player.getLevel() > Config.MAX_FREE_TELEPORT_LEVEL) || player.isSubClassActive()) && ((loc.getFeeId() != 0) && (loc.getFeeCount() > 0))); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| @@ -283,7 +283,7 @@ public final class TeleportHolder | ||||
| 	 */ | ||||
| 	private long calculateFee(L2PcInstance player, TeleportLocation loc) | ||||
| 	{ | ||||
| 		if (_type == TeleportType.NORMAL) | ||||
| 		if (isNormalTeleport()) | ||||
| 		{ | ||||
| 			if (!player.isSubClassActive() && (player.getLevel() <= Config.MAX_FREE_TELEPORT_LEVEL)) | ||||
| 			{ | ||||
| @@ -301,6 +301,11 @@ public final class TeleportHolder | ||||
| 		return loc.getFeeCount(); | ||||
| 	} | ||||
| 	 | ||||
| 	private boolean isNormalTeleport() | ||||
| 	{ | ||||
| 		return (_type == TeleportType.NORMAL) || (_type == TeleportType.HUNTING); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Gets name of specified item. | ||||
| 	 * @param itemId template id of item | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment