Simplifications and corrections for Race Track and Fantasy teleports.
This commit is contained in:
		| @@ -19,67 +19,47 @@ package ai.others.TeleportToRaceTrack; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.l2jmobius.gameserver.enums.ChatType; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.actor.Npc; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; | ||||
| import org.l2jmobius.gameserver.network.NpcStringId; | ||||
|  | ||||
| import ai.AbstractNpcAI; | ||||
|  | ||||
| /** | ||||
|  * Monster Derby Track teleport AI. | ||||
|  * @author Plim | ||||
|  * @author Mobius | ||||
|  */ | ||||
| public class TeleportToRaceTrack extends AbstractNpcAI | ||||
| { | ||||
| 	// NPC | ||||
| 	private static final int RACE_MANAGER = 30995; | ||||
| 	// Locations | ||||
| 	private static final Location TELEPORT = new Location(12661, 181687, -3540); | ||||
| 	private static final Location DION_CASTLE_TOWN = new Location(15670, 142983, -2700); | ||||
| 	private static final Location[] RETURN_LOCATIONS = | ||||
| 	{ | ||||
| 		new Location(-80826, 149775, -3043), | ||||
| 		new Location(-12672, 122776, -3116), | ||||
| 		new Location(15670, 142983, -2705), | ||||
| 		new Location(83400, 147943, -3404), | ||||
| 		new Location(111409, 219364, -3545), | ||||
| 		new Location(82956, 53162, -1495), | ||||
| 		new Location(146331, 25762, -2018), | ||||
| 		new Location(116819, 76994, -2714), | ||||
| 		new Location(43835, -47749, -792), | ||||
| 		new Location(147930, -55281, -2728), | ||||
| 		new Location(87386, -143246, -1293), | ||||
| 		new Location(12882, 181053, -3560) | ||||
| 	}; | ||||
| 	// Misc | ||||
| 	private static final Map<Integer, Integer> TELEPORTERS = new HashMap<>(); | ||||
| 	private static final Location RACE_TRACK_TELEPORT = new Location(12661, 181687, -3540); | ||||
| 	private static final Map<Integer, Location> TELEPORTER_LOCATIONS = new HashMap<>(); | ||||
| 	static | ||||
| 	{ | ||||
| 		TELEPORTERS.put(30320, 0); // Richlin | ||||
| 		TELEPORTERS.put(30256, 1); // Bella | ||||
| 		TELEPORTERS.put(30059, 2); // Trisha | ||||
| 		TELEPORTERS.put(30080, 3); // Clarissa | ||||
| 		TELEPORTERS.put(30899, 4); // Flauen | ||||
| 		TELEPORTERS.put(30177, 5); // Valentina | ||||
| 		TELEPORTERS.put(30848, 6); // Elisa | ||||
| 		TELEPORTERS.put(30233, 7); // Esmeralda | ||||
| 		TELEPORTERS.put(31320, 8); // Ilyana | ||||
| 		TELEPORTERS.put(31275, 9); // Tatiana | ||||
| 		TELEPORTERS.put(31964, 10); // Bilia | ||||
| 		TELEPORTERS.put(31210, 11); // Race Track Gatekeeper | ||||
| 		TELEPORTER_LOCATIONS.put(30320, new Location(-80826, 149775, -3043)); // Richlin | ||||
| 		TELEPORTER_LOCATIONS.put(30256, new Location(-12672, 122776, -3116)); // Bella | ||||
| 		TELEPORTER_LOCATIONS.put(30059, new Location(15670, 142983, -2705)); // Trisha | ||||
| 		TELEPORTER_LOCATIONS.put(30080, new Location(83400, 147943, -3404)); // Clarissa | ||||
| 		TELEPORTER_LOCATIONS.put(30899, new Location(111409, 219364, -3545)); // Flauen | ||||
| 		TELEPORTER_LOCATIONS.put(30177, new Location(82956, 53162, -1495)); // Valentina | ||||
| 		TELEPORTER_LOCATIONS.put(30848, new Location(146331, 25762, -2018)); // Elisa | ||||
| 		TELEPORTER_LOCATIONS.put(30233, new Location(116819, 76994, -2714)); // Esmeralda | ||||
| 		TELEPORTER_LOCATIONS.put(31320, new Location(43835, -47749, -792)); // Ilyana | ||||
| 		TELEPORTER_LOCATIONS.put(31275, new Location(147930, -55281, -2728)); // Tatiana | ||||
| 		TELEPORTER_LOCATIONS.put(31964, new Location(87386, -143246, -1293)); // Bilia | ||||
| 		TELEPORTER_LOCATIONS.put(31210, new Location(12882, 181053, -3560)); // Race Track Gatekeeper | ||||
| 	} | ||||
| 	 | ||||
| 	// Player Variables | ||||
| 	// Other | ||||
| 	private static final String MONSTER_RETURN = "MONSTER_RETURN"; | ||||
| 	 | ||||
| 	private TeleportToRaceTrack() | ||||
| 	{ | ||||
| 		addStartNpc(RACE_MANAGER); | ||||
| 		addStartNpc(TELEPORTERS.keySet()); | ||||
| 		addStartNpc(TELEPORTER_LOCATIONS.keySet()); | ||||
| 		addTalkId(RACE_MANAGER); | ||||
| 		addTalkId(TELEPORTERS.keySet()); | ||||
| 		addTalkId(TELEPORTER_LOCATIONS.keySet()); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -88,22 +68,20 @@ public class TeleportToRaceTrack extends AbstractNpcAI | ||||
| 		if (npc.getId() == RACE_MANAGER) | ||||
| 		{ | ||||
| 			final int returnId = player.getVariables().getInt(MONSTER_RETURN, -1); | ||||
| 			 | ||||
| 			if (returnId != -1) | ||||
| 			if (returnId > 30000) // Old script compatibility. | ||||
| 			{ | ||||
| 				player.teleToLocation(RETURN_LOCATIONS[returnId]); | ||||
| 				player.teleToLocation(TELEPORTER_LOCATIONS.get(returnId)); | ||||
| 				player.getVariables().remove(MONSTER_RETURN); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOUR_MEANS_OF_ARRIVAL_WAS_A_BIT_UNCONVENTIONAL_THEN_I_LL_BE_SENDING_YOU_BACK_TO_THE_TOWN_OF_RUNE_WHICH_IS_THE_NEAREST_TOWN); | ||||
| 				player.teleToLocation(DION_CASTLE_TOWN); | ||||
| 				player.teleToLocation(TELEPORTER_LOCATIONS.get(30059)); // Dion | ||||
| 			} | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			player.teleToLocation(TELEPORT); | ||||
| 			player.getVariables().set(MONSTER_RETURN, String.valueOf(TELEPORTERS.get(npc.getId()))); | ||||
| 			player.teleToLocation(RACE_TRACK_TELEPORT); | ||||
| 			player.getVariables().set(MONSTER_RETURN, npc.getId()); | ||||
| 		} | ||||
| 		return super.onTalk(npc, player); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment