Lailly AI improvements.
Contributed by gigilo1968.
This commit is contained in:
		| @@ -0,0 +1,5 @@ | ||||
| <html><body>Madame Lailly:<br> | ||||
| Hmm? You weren't listening to a story? Or have you listened to all of them?<br> | ||||
| I understand that you want to listen to more great stories, but patience is a virtue!<br> | ||||
| <Button ALIGN=LEFT ICON="RETURN" action="bypass -h Quest Lailly 34181.html">Back</Button> | ||||
| </body></html> | ||||
| @@ -0,0 +1,7 @@ | ||||
| <html><body>Madame Lailly:<br> | ||||
| Welcome. Thank you for coming all the way here.<br> | ||||
| I'm Lailly, and my husband is the owner of this tavern. You met Settlen, right?<br> | ||||
| His health had been deteriorating, but I think he's been getting better since we settled down here. Please come by often!<br> | ||||
| <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Lailly okay">"Okay."</Button> | ||||
| <Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button> | ||||
| </body></html> | ||||
| @@ -14,11 +14,13 @@ | ||||
|  * 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.GainakUnderground; | ||||
| package ai.areas.GainakUnderground.Lailly; | ||||
| 
 | ||||
| import com.l2jmobius.gameserver.enums.ChatType; | ||||
| import com.l2jmobius.gameserver.instancemanager.InstanceManager; | ||||
| import com.l2jmobius.gameserver.model.actor.Npc; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; | ||||
| import com.l2jmobius.gameserver.model.instancezone.Instance; | ||||
| import com.l2jmobius.gameserver.network.NpcStringId; | ||||
| import com.l2jmobius.gameserver.network.serverpackets.NpcSay; | ||||
| 
 | ||||
| @@ -32,29 +34,70 @@ public final class Lailly extends AbstractNpcAI | ||||
| { | ||||
| 	// NPCs | ||||
| 	private static final int LAILLY = 34181; | ||||
| 	// Instances | ||||
| 	private static final int INSTANCE_TAUTI = 261; | ||||
| 	private static final int INSTANCE_KELBIM = 262; | ||||
| 	private static final int INSTANCE_FREYA = 263; | ||||
| 	 | ||||
| 	private Lailly() | ||||
| 	{ | ||||
| 		addSpawnId(LAILLY); | ||||
| 		addFirstTalkId(LAILLY); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onAdvEvent(String event, Npc npc, PlayerInstance player) | ||||
| 	{ | ||||
| 		if (event.equals("SPAM_TEXT") && (npc != null)) | ||||
| 		String htmltext = null; | ||||
| 		switch (event) | ||||
| 		{ | ||||
| 			npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.READY_TO_LISTEN_TO_A_STORY_COME_NOW)); | ||||
| 			case "34181.html": | ||||
| 			{ | ||||
| 				htmltext = event; | ||||
| 				break; | ||||
| 			} | ||||
| 			case "spam_text": | ||||
| 			{ | ||||
| 				npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.READY_TO_LISTEN_TO_A_STORY_COME_NOW)); | ||||
| 				break; | ||||
| 			} | ||||
| 			case "okay": | ||||
| 			{ | ||||
| 				final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false); | ||||
| 				if ((instance != null) && (instance.getEndTime() > System.currentTimeMillis())) | ||||
| 				{ | ||||
| 					switch (instance.getTemplateId()) | ||||
| 					{ | ||||
| 						case INSTANCE_TAUTI: | ||||
| 						case INSTANCE_KELBIM: | ||||
| 						case INSTANCE_FREYA: | ||||
| 						{ | ||||
| 							player.teleToLocation(instance.getEnterLocation(), instance); | ||||
| 							break; | ||||
| 						} | ||||
| 					} | ||||
| 					break; | ||||
| 				} | ||||
| 				htmltext = "34181-1.html"; | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		return super.onAdvEvent(event, npc, player); | ||||
| 		return htmltext; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onSpawn(Npc npc) | ||||
| 	{ | ||||
| 		startQuestTimer("SPAM_TEXT", 180000, npc, null, true); | ||||
| 		startQuestTimer("spam_text", 180000, npc, null, true); | ||||
| 		return super.onSpawn(npc); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String onFirstTalk(Npc npc, PlayerInstance player) | ||||
| 	{ | ||||
| 		return "34181.html"; | ||||
| 	} | ||||
| 	 | ||||
| 	public static void main(String[] args) | ||||
| 	{ | ||||
| 		new Lailly(); | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment