Addition of Nerva's prison AIs.
Contributed by Index.
This commit is contained in:
		| @@ -0,0 +1,3 @@ | ||||
| <html><body>Kaysen:<br> | ||||
| What? I can't hear you! Just open the door. | ||||
| </body></html> | ||||
| @@ -0,0 +1,4 @@ | ||||
| <html><body>Kaysen:<br> | ||||
| Thanks for comming in this danger place. Can you listen me?<br> | ||||
| <button align="LEFT" icon="NORMAL" action="bypass -h Quest Kaysen KAYSEN_OKAY">"Okay"</button> | ||||
| </body></html> | ||||
							
								
								
									
										170
									
								
								L2J_Mobius_02.5_Underground/dist/game/data/scripts/ai/areas/RaidersCrossroads/Kaysen/Kaysen.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										170
									
								
								L2J_Mobius_02.5_Underground/dist/game/data/scripts/ai/areas/RaidersCrossroads/Kaysen/Kaysen.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,170 @@ | ||||
| /* | ||||
|  * This file is part of the L2J Mobius project. | ||||
|  *  | ||||
|  * 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 ai.areas.RaidersCrossroads.Kaysen; | ||||
|  | ||||
| import org.l2jmobius.commons.util.Rnd; | ||||
| import org.l2jmobius.gameserver.enums.ChatType; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.World; | ||||
| import org.l2jmobius.gameserver.model.actor.Npc; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.Door; | ||||
| import org.l2jmobius.gameserver.model.holders.ItemHolder; | ||||
| import org.l2jmobius.gameserver.network.NpcStringId; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; | ||||
|  | ||||
| import ai.AbstractNpcAI; | ||||
|  | ||||
| /** | ||||
|  * Saving the Treasure Dealer<br> | ||||
|  * Raider's Crossroads belongs to the Nerva Orcs who have built many barracks there. Among other buildings, there's a prison where the Treasure Dealer is held captive.<br> | ||||
|  * When you kill the Nerva Orcs on the Raider's Crossroads, there's a certain probability of getting Nerva's Temporary Prison Key. The key is used to open the door to Nerva's Temporary Prison.<br> | ||||
|  * If you save Treasure Dealer Kaysen and then talk to him, there's a low probability of getting an additional reward. However, Kaysen may turn into a monster - Nerva Kaiser.<br> | ||||
|  * @author Index | ||||
|  */ | ||||
| public class Kaysen extends AbstractNpcAI | ||||
| { | ||||
| 	// NPCs | ||||
| 	private static final int KAYSEN = 19458; | ||||
| 	private static final int NERVAS_TEMPORARY_PRISON = 19459; | ||||
| 	private static final int NERVAS_KAYSEN = 23329; | ||||
| 	// Reward | ||||
| 	private static final ItemHolder REWARD = new ItemHolder(57, 1000000); | ||||
| 	// Locations | ||||
| 	private static final Location[] SPAWN_LOCATIONS = | ||||
| 	{ | ||||
| 		new Location(6636, -139744, -648, 26632), | ||||
| 		new Location(8662, -146437, -312, 39968), | ||||
| 		new Location(10668, -136336, -1192, 21368), | ||||
| 		new Location(11820, -141016, -592, 57448), | ||||
| 		new Location(18232, -136944, -896, 51256), | ||||
| 		new Location(20032, -142116, -576, 46192), | ||||
| 		new Location(22684, -139168, -744, 9416), | ||||
| 		new Location(23120, -146104, -464, 8732) | ||||
| 	}; | ||||
| 	// Misc | ||||
| 	private static final int REWARD_CHANCE = 10; | ||||
| 	private static final long EXP_REWARD = 1000000000; | ||||
| 	 | ||||
| 	private Kaysen() | ||||
| 	{ | ||||
| 		addStartNpc(KAYSEN); | ||||
| 		addFirstTalkId(KAYSEN); | ||||
| 		addTalkId(KAYSEN); | ||||
| 		addSpawnId(KAYSEN); | ||||
| 		addKillId(NERVAS_KAYSEN); | ||||
| 		 | ||||
| 		for (Location location : SPAWN_LOCATIONS) | ||||
| 		{ | ||||
| 			addSpawn(KAYSEN, location); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onAdvEvent(String event, Npc npc, Player player) | ||||
| 	{ | ||||
| 		switch (event) | ||||
| 		{ | ||||
| 			case "NPC_SHOUT": | ||||
| 			{ | ||||
| 				if (npc.isSpawned()) | ||||
| 				{ | ||||
| 					for (Door door : World.getInstance().getVisibleObjectsInRange(npc, Door.class, Npc.INTERACTION_DISTANCE)) | ||||
| 					{ | ||||
| 						if (!door.isOpen()) | ||||
| 						{ | ||||
| 							npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FIND_THE_PRISON_KEY_CARRIED_BY_THE_NERVA_ORCS_AND_GET_ME_OUT_OF_HERE_I_LL_MAKE_IT_WORTH_YOUR_WHILE_I_PROMISE); | ||||
| 							startQuestTimer("NPC_SHOUT", getRandom(10, 15) * 1000, npc, null); | ||||
| 							break; | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			case "KAYSEN_OKAY": | ||||
| 			{ | ||||
| 				if (player.calculateDistance3D(npc) < Npc.INTERACTION_DISTANCE) | ||||
| 				{ | ||||
| 					if (Rnd.get(100) < REWARD_CHANCE) | ||||
| 					{ | ||||
| 						player.addItem("Kaysen Reward", REWARD, player, true); | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WHAT_WHAT_S_HAPPENING_TO_MY_BODY_ARGH); | ||||
| 						startQuestTimer("KAYSEN_TRANSFORM", 3000, npc, null); | ||||
| 					} | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			case "KAYSEN_TRANSFORM": | ||||
| 			{ | ||||
| 				npc.deleteMe(); | ||||
| 				addSpawn(NERVAS_KAYSEN, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 180000); | ||||
| 				startQuestTimer("KAYSEN_RESPAWN", 3600000, npc, null); | ||||
| 				break; | ||||
| 			} | ||||
| 			case "KAYSEN_RESPAWN": | ||||
| 			{ | ||||
| 				addSpawn(KAYSEN, npc); | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onFirstTalk(Npc npc, Player player) | ||||
| 	{ | ||||
| 		for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, Npc.INTERACTION_DISTANCE)) | ||||
| 		{ | ||||
| 			if (nearby.getId() == NERVAS_TEMPORARY_PRISON) | ||||
| 			{ | ||||
| 				return "19458-no.html"; | ||||
| 			} | ||||
| 		} | ||||
| 		return "19458.html"; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onSpawn(Npc npc) | ||||
| 	{ | ||||
| 		startQuestTimer("NPC_SHOUT", getRandom(10, 15) * 1000, npc, null); | ||||
| 		return super.onSpawn(npc); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onKill(Npc npc, Player killer, boolean isSummon) | ||||
| 	{ | ||||
| 		final Player player = killer.getActingPlayer(); | ||||
| 		if (Math.abs(player.getLevel() - npc.getLevel()) > 9) | ||||
| 		{ | ||||
| 			player.addExpAndSp(EXP_REWARD / 40, 0); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			player.addExpAndSp(EXP_REWARD, 0); | ||||
| 		} | ||||
| 		player.broadcastPacket(new ExShowScreenMessage(NpcStringId.YOU_HAVE_OBTAINED_EXTRA_XP, ExShowScreenMessage.TOP_CENTER, 10000)); | ||||
| 		return super.onKill(npc, killer, isSummon); | ||||
| 	} | ||||
| 	 | ||||
| 	public static void main(String[] args) | ||||
| 	{ | ||||
| 		new Kaysen(); | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,3 @@ | ||||
| <html><body>Nerva's Temporary Prison:<br> | ||||
| You don't have a key to open the door of Nerva's Temporary Prison on Raider's Crossroads. | ||||
| </body></html> | ||||
| @@ -0,0 +1,4 @@ | ||||
| <html><body>Nerva's Temporary Prison:<br> | ||||
| Open the door of Nerva's Temporary Prison on Raider's Crossroads.<br> | ||||
| <button align="LEFT" icon="NORMAL" action="bypass -h Quest NervasTemporaryPrison OPEN">Start picking</button> | ||||
| </body></html> | ||||
| @@ -0,0 +1,122 @@ | ||||
| /* | ||||
|  * This file is part of the L2J Mobius project. | ||||
|  *  | ||||
|  * 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 ai.areas.RaidersCrossroads.NervasTemporaryPrison; | ||||
|  | ||||
| import org.l2jmobius.gameserver.enums.ChatType; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.World; | ||||
| import org.l2jmobius.gameserver.model.actor.Npc; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.Door; | ||||
| import org.l2jmobius.gameserver.network.NpcStringId; | ||||
|  | ||||
| import ai.AbstractNpcAI; | ||||
|  | ||||
| /** | ||||
|  * @author Index | ||||
|  */ | ||||
| public class NervasTemporaryPrison extends AbstractNpcAI | ||||
| { | ||||
| 	// NPCs | ||||
| 	private static final int KAYSEN = 19458; | ||||
| 	private static final int NERVAS_TEMPORARY_PRISON = 19459; | ||||
| 	// Locations | ||||
| 	private static final Location[] SPAWN_LOCATIONS = | ||||
| 	{ | ||||
| 		new Location(10595, -136216, -1192), | ||||
| 		new Location(11924, -141102, -592), | ||||
| 		new Location(18263, -137084, -896), | ||||
| 		new Location(19991, -142252, -576), | ||||
| 		new Location(22752, -139032, -744), | ||||
| 		new Location(23220, -146000, -464), | ||||
| 		new Location(6516, -139680, -656), | ||||
| 		new Location(8555, -146514, -312), | ||||
| 	}; | ||||
| 	// Item | ||||
| 	private static final int NERVA_KEY = 36665; | ||||
| 	 | ||||
| 	private NervasTemporaryPrison() | ||||
| 	{ | ||||
| 		addStartNpc(NERVAS_TEMPORARY_PRISON); | ||||
| 		addFirstTalkId(NERVAS_TEMPORARY_PRISON); | ||||
| 		addTalkId(NERVAS_TEMPORARY_PRISON); | ||||
| 		addSpawnId(NERVAS_TEMPORARY_PRISON); | ||||
| 		 | ||||
| 		for (Location location : SPAWN_LOCATIONS) | ||||
| 		{ | ||||
| 			addSpawn(NERVAS_TEMPORARY_PRISON, location); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onAdvEvent(String event, Npc npc, Player player) | ||||
| 	{ | ||||
| 		switch (event) | ||||
| 		{ | ||||
| 			case "OPEN": | ||||
| 			{ | ||||
| 				if (hasQuestItems(player, NERVA_KEY)) | ||||
| 				{ | ||||
| 					for (Door door : World.getInstance().getVisibleObjectsInRange(npc, Door.class, Npc.INTERACTION_DISTANCE)) | ||||
| 					{ | ||||
| 						door.openMe(); | ||||
| 					} | ||||
| 					 | ||||
| 					for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, Npc.INTERACTION_DISTANCE)) | ||||
| 					{ | ||||
| 						if (nearby.getId() == KAYSEN) | ||||
| 						{ | ||||
| 							nearby.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_TOOK_DOWN_THE_NERVA_ORCS_AND_GOT_THEIR_TEMPORARY_PRISON_KEY); | ||||
| 							break; | ||||
| 						} | ||||
| 					} | ||||
| 					 | ||||
| 					takeItems(player, NERVA_KEY, 1); | ||||
| 					 | ||||
| 					npc.deleteMe(); | ||||
| 					startQuestTimer("PRISON_RESPAWN", 3600000, npc, null); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					return "19459-no.html"; | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			case "PRISON_RESPAWN": | ||||
| 			{ | ||||
| 				addSpawn(NERVAS_TEMPORARY_PRISON, npc); | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onSpawn(Npc npc) | ||||
| 	{ | ||||
| 		for (Door door : World.getInstance().getVisibleObjectsInRange(npc, Door.class, Npc.INTERACTION_DISTANCE)) | ||||
| 		{ | ||||
| 			door.closeMe(); | ||||
| 		} | ||||
| 		return super.onSpawn(npc); | ||||
| 	} | ||||
| 	 | ||||
| 	public static void main(String[] args) | ||||
| 	{ | ||||
| 		new NervasTemporaryPrison(); | ||||
| 	} | ||||
| } | ||||
| @@ -23,22 +23,6 @@ | ||||
| 			<npc id="19323" x="19892" y="-130121" z="-1704" heading="47148" respawnTime="60sec" /> <!-- Raiders Crossroads Decor --> | ||||
| 			<npc id="19323" x="19908" y="-130059" z="-1704" heading="47148" respawnTime="60sec" /> <!-- Raiders Crossroads Decor --> | ||||
| 			<npc id="19323" x="19928" y="-130000" z="-1696" heading="47412" respawnTime="60sec" /> <!-- Raiders Crossroads Decor --> | ||||
| 			<npc id="19458" x="10668" y="-136336" z="-1192" heading="21368" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="11820" y="-141016" z="-592" heading="57448" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="18232" y="-136944" z="-896" heading="51256" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="20032" y="-142116" z="-576" heading="46192" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="22684" y="-139168" z="-744" heading="9416" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="23120" y="-146104" z="-464" heading="8732" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="6636" y="-139744" z="-648" heading="26632" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19458" x="8662" y="-146437" z="-312" heading="39968" respawnTime="60sec" /> <!-- Treasure Dealer Kaysen --> | ||||
| 			<npc id="19459" x="10595" y="-136216" z="-1192" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="11924" y="-141102" z="-592" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="18263" y="-137084" z="-896" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="19991" y="-142252" z="-576" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="22752" y="-139032" z="-744" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="23220" y="-146000" z="-464" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="6516" y="-139680" z="-656" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="19459" x="8555" y="-146514" z="-312" heading="0" respawnTime="60sec" /> <!-- Nervas Temporary Prison --> | ||||
| 			<npc id="23314" x="10197" y="-141310" z="-656" heading="33117" respawnTime="60sec" /> <!-- Nerva Orc Raider --> | ||||
| 			<npc id="23314" x="10210" y="-137310" z="-1176" heading="24289" respawnTime="60sec" /> <!-- Nerva Orc Raider --> | ||||
| 			<npc id="23314" x="10396" y="-135793" z="-1192" heading="51005" respawnTime="60sec" /> <!-- Nerva Orc Raider --> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment