diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java index 27a3b05432258ad86c1c8b6bfb56dfaeead14b72..c12e2d11b8b177ec32e205f0c1327f6f5c17f84e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java @@ -27,7 +27,6 @@ import com.l2jserver.gameserver.instancemanager.TownManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.zone.type.L2TownZone; /** @@ -37,18 +36,24 @@ import com.l2jserver.gameserver.model.zone.type.L2TownZone; public final class DelusionTeleport extends AbstractNpcAI { // NPCs - // @formatter:off private static final int[] NPCS = { - 32484, 32658, 32659, 32660, 32661, 32662, 32663 + 32484, // Pathfinder Worker + 32658, // Guardian of Eastern Seal + 32659, // Guardian of Western Seal + 32660, // Guardian of Southern Seal + 32661, // Guardian of Northern Seal + 32662, // Guardian of Great Seal + 32663, // Guardian of Tower of Seal }; - // @formatter:on - // Misc + // Location private static final Location[] HALL_LOCATIONS = { new Location(-114597, -152501, -6750), new Location(-114589, -154162, -6750) }; + // Player Variables + private static final String DELUSION_RETURN = "DELUSION_RETURN"; private static final Map<Integer, Location> RETURN_LOCATIONS = new HashMap<>(); @@ -73,22 +78,20 @@ public final class DelusionTeleport extends AbstractNpcAI @Override public String onTalk(L2Npc npc, L2PcInstance player) { - final QuestState st = player.getQuestState(getName()); - - if (npc.getId() == NPCS[0]) + if (npc.getId() == NPCS[0]) // Pathfinder Worker { final L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ()); final int townId = ((town == null) ? 0 : town.getTownId()); - st.set("return_loc", Integer.toString(townId)); + player.getVariables().set(DELUSION_RETURN, townId); player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false); } else { - player.teleToLocation(RETURN_LOCATIONS.get(st.getInt("return_loc")), true); - st.exitQuest(true); + final int townId = player.getVariables().getInt(DELUSION_RETURN, 0); + player.teleToLocation(RETURN_LOCATIONS.get(townId), true); + player.getVariables().remove(DELUSION_RETURN); } - - return ""; + return super.onTalk(npc, player); } public static void main(String[] args)