瀏覽代碼

BETA: Reworked '''Lekon''' AI.
* Reviewed by: Zoey76, !UnAfraid

St3eT 11 年之前
父節點
當前提交
ad8265e20b

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -37,6 +37,7 @@ ai/npc/FortuneTelling/FortuneTelling.java
 ai/npc/FreyasSteward/FreyasSteward.java
 ai/npc/Jinia/Jinia.java
 ai/npc/KetraOrcSupport/KetraOrcSupport.java
+ai/npc/Lekon/Lekon.java
 ai/npc/MercenaryCaptain/MercenaryCaptain.java
 ai/npc/Minigame/Minigame.java
 ai/npc/MonumentOfHeroes/MonumentOfHeroes.java
@@ -335,7 +336,6 @@ vehicles/BoatRunePrimeval.java
 vehicles/AirShipGludioGracia/AirShipGludioGracia.java
 
 # AirShip Controllers
-vehicles/EngineerLekon/EngineerLekon.java
 vehicles/KeucereusNorthController/KeucereusNorthController.java
 vehicles/KeucereusSouthController/KeucereusSouthController.java
 vehicles/SoIController/SoIController.java

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/vehicles/EngineerLekon/32557-1.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/32557-01.html

@@ -3,5 +3,5 @@ Airship, eh? If you want board an Airship, you need to first register for a Summ
 Only <font color="LEVEL">clan lords whose clan is level 5 or higher</font> may earn the license. There is also a limit on the number of Airships.<br>
 If you meet the requirements, you can obtain a Airship Summon License in exchange for <font color="LEVEL">10 Energy Star Stones</font>.<br>
 An Energy Star Stone can be made by assembling Star Stones found floating in the skies over Gracia. If you thinkk this is too time-consuming, you can also buy them from Officer Tolonis right over there..<br>
-<a action="bypass -h Quest EngineerLekon license">Obtain the Airship Summon License.</a>
+<a action="bypass -h Quest Lekon licence">Obtain the Airship Summon License.</a>
 </body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/32557-02.html

@@ -0,0 +1,3 @@
+<html><body>Engineer Lekon:<br>
+Only a clan lord whose clan is level 5 or above can be issued an Airship Summon License.
+</body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/32557-03.html

@@ -0,0 +1,3 @@
+<html><head><body>Engineer Lekon:<br>
+You don't have enough Energy Star Stones yet. You can make them by assembling Star Stones found floating in the skies over Gracia. If you prefer, you can also purchase them from Officer Tolonis.
+</body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/32557-04.html

@@ -0,0 +1,3 @@
+<html><body>Engineer Lekon:<br>
+Hey, I see here that you already have a Airship Summon License! Haven't you registered it yet? Or did you lose it already?
+</body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/vehicles/EngineerLekon/32557.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/32557.html

@@ -2,6 +2,6 @@
 I'm too busy to take a breath! I'm supposed to maintain all these Airships and air vehicles by myself?! How does that make sense?<br>
 And it's all very detailed, time-consuming work with no margin for error. Somebody up there must really hate me!<br>
 Well, at least they supply me with the materials I need. Hey, adventurer! You must know how to use Airships or air vehicles. Care to lend me a hand?<br>
-<a action="bypass -h Quest EngineerLekon 32557-1.htm">Ask about Airship Summon License.</a><br>
+<a action="bypass -h Quest Lekon 32557-01.html">Ask about Airship Summon License.</a><br>
 <a action="bypass -h npc_%objectId%_Quest">Quest</a>
 </body></html>

+ 97 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Lekon/Lekon.java

@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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.npc.Lekon;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.instancemanager.AirShipManager;
+import com.l2jserver.gameserver.model.L2Clan;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
+
+/**
+ * Lekon AI.
+ * @author St3eT
+ */
+public final class Lekon extends AbstractNpcAI
+{
+	// NPCs
+	private static final int LEKON = 32557;
+	// Items
+	private static final int LICENCE = 13559; // Airship Summon License
+	private static final int STONE = 13277; // Energy Star Stone
+	// Misc
+	private static final int MIN_CLAN_LV = 5;
+	private static final int STONE_COUNT = 10;
+	
+	private Lekon()
+	{
+		super(Lekon.class.getSimpleName(), "ai/npc");
+		addFirstTalkId(LEKON);
+		addTalkId(LEKON);
+		addStartNpc(LEKON);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		switch (event)
+		{
+			case "32557-01.html":
+			{
+				htmltext = event;
+				break;
+			}
+			case "licence":
+			{
+				final L2Clan clan = player.getClan();
+				if ((clan == null) || !player.isClanLeader() || (clan.getLevel() < MIN_CLAN_LV))
+				{
+					htmltext = "32557-02.html";
+				}
+				else if (hasAtLeastOneQuestItem(player, LICENCE))
+				{
+					htmltext = "32557-04.html";
+				}
+				else if (AirShipManager.getInstance().hasAirShipLicense(clan.getId()))
+				{
+					player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED);
+				}
+				else if (getQuestItemsCount(player, STONE) >= STONE_COUNT)
+				{
+					takeItems(player, STONE, STONE_COUNT);
+					giveItems(player, LICENCE, 1);
+				}
+				else
+				{
+					htmltext = "32557-03.html";
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	public static void main(String args[])
+	{
+		new Lekon();
+	}
+}

+ 0 - 94
L2J_DataPack_BETA/dist/game/data/scripts/vehicles/EngineerLekon/EngineerLekon.java

@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2004-2014 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 vehicles.EngineerLekon;
-
-import com.l2jserver.gameserver.instancemanager.AirShipManager;
-import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.quest.Quest;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
-
-public final class EngineerLekon extends Quest
-{
-	private static final int LEKON = 32557;
-	
-	private static final int LICENSE = 13559;
-	private static final int STARSTONE = 13277;
-	private static final int LICENSE_COST = 10;
-	
-	private static final SystemMessage SM_NEED_CLANLVL5 = SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_CLANLVL_5_TO_SUMMON);
-	private static final SystemMessage SM_NO_PRIVS = SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES);
-	private static final SystemMessage SM_LICENSE_ALREADY_ACQUIRED = SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED);
-	
-	private EngineerLekon()
-	{
-		super(-1, EngineerLekon.class.getSimpleName(), "vehicles");
-		addStartNpc(LEKON);
-		addFirstTalkId(LEKON);
-		addTalkId(LEKON);
-	}
-	
-	@Override
-	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
-	{
-		if ("license".equalsIgnoreCase(event))
-		{
-			if ((player.getClan() == null) || (player.getClan().getLevel() < 5))
-			{
-				player.sendPacket(SM_NEED_CLANLVL5);
-				return null;
-			}
-			if (!player.isClanLeader())
-			{
-				player.sendPacket(SM_NO_PRIVS);
-				return null;
-			}
-			if (AirShipManager.getInstance().hasAirShipLicense(player.getClanId()))
-			{
-				player.sendPacket(SM_LICENSE_ALREADY_ACQUIRED);
-				return null;
-			}
-			if (player.getInventory().getItemByItemId(LICENSE) != null)
-			{
-				player.sendPacket(SM_LICENSE_ALREADY_ACQUIRED);
-				return null;
-			}
-			if (!player.destroyItemByItemId("AirShipLicense", STARSTONE, LICENSE_COST, npc, true))
-			{
-				return null;
-			}
-			
-			player.addItem("AirShipLicense", LICENSE, 1, npc, true);
-			return null;
-		}
-		return event;
-	}
-	
-	@Override
-	public String onFirstTalk(L2Npc npc, L2PcInstance player)
-	{
-		return npc.getId() + ".htm";
-	}
-	
-	public static void main(String[] args)
-	{
-		new EngineerLekon();
-	}
-}