diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg index ba1a90ff57383bf05bdb21f2e86f7920952e3a90..3fc037ad14df913835ede3e7a8a2dfd0bc03223c 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg +++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg @@ -16,7 +16,7 @@ ai/npc/NpcBuffers/BirthdayCake.java ai/npc/NpcBuffers/CabaleBuffer.java ai/npc/NpcBuffers/ChristmasTree.java ai/npc/NpcBuffers/Totems.java -ai/npc/TerritoryManagers/TerritoryManagers.java +ai/npc/PriestOfBlessing/PriestOfBlessing.java ai/npc/Teleports/CrumaTower/CrumaTower.java ai/npc/Teleports/ElrokiTeleporters/ElrokiTeleporters.java ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java @@ -38,6 +38,7 @@ ai/npc/Teleports/TeleportToUndergroundColiseum/TeleportToUndergroundColiseum.jav ai/npc/Teleports/TeleportWithCharm/TeleportWithCharm.java ai/npc/Teleports/ToIVortex/ToIVortex.java ai/npc/Teleports/Warpgate/Warpgate.java +ai/npc/TerritoryManagers/TerritoryManagers.java # Fantasy Isle ai/fantasy_isle/MC_Show.java @@ -728,9 +729,6 @@ custom/PinsAndPouchUnseal/PinsAndPouchUnseal.java custom/Validators/SkillTransferValidator.java custom/Validators/SubClassSkills.java -# Retail -retail/PriestOfBlessing/PriestOfBlessing.java - # Vehicles vehicles/BoatTalkingGludin.java vehicles/BoatGiranTalking.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-1.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-1.htm similarity index 100% rename from L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-1.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-1.htm diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-2.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-2.htm similarity index 100% rename from L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-2.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-2.htm diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-adena.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-adena.htm similarity index 100% rename from L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783-adena.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783-adena.htm diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783.htm similarity index 100% rename from L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/32783.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/32783.htm diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/PriestOfBlessing.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java similarity index 54% rename from L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/PriestOfBlessing.java rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java index 536bf3f835e62658f86b2a7b9f57617f4a500332..0b384ee0aa2ff60011aee03ede583334098ec16c 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/retail/PriestOfBlessing/PriestOfBlessing.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java @@ -12,13 +12,14 @@ * 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 retail.PriestOfBlessing; +package ai.npc.PriestOfBlessing; +import ai.npc.AbstractNpcAI; + +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.Quest; -import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.model.quest.State; +import com.l2jserver.gameserver.model.itemcontainer.PcInventory; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; @@ -28,18 +29,16 @@ import com.l2jserver.gameserver.util.Util; * Priest Of Blessing AI. * @author Gnacik */ -public class PriestOfBlessing extends Quest +public class PriestOfBlessing extends AbstractNpcAI { // Spawn state - private static boolean _spawned = false; + private static boolean SPAWNED = false; // NPC - private static final int _priest = 32783; + private static final int PRIEST = 32783; // Prices - private static final int _price_voice = 100000; - // - private static final int _nevit_voice = 17094; - // - private static final int[] _prices_hourglass = + private static final int PRICE_VOICE = 100000; + private static final int NEVIT_VOICE = 17094; + private static final int[] PRIEVE_HOURGLASS = { 4000, 30000, @@ -49,188 +48,72 @@ public class PriestOfBlessing extends Quest 2160000, 5000000 }; - // - private static final int[][] _hourglasses = + // @formatter:off + private static final int[][] HOURGLASSES = { - { - 17095, - 17096, - 17097, - 17098, - 17099 - }, - { - 17100, - 17101, - 17102, - 17103, - 17104 - }, - { - 17105, - 17106, - 17107, - 17108, - 17109 - }, - { - 17110, - 17111, - 17112, - 17113, - 17114 - }, - { - 17115, - 17116, - 17117, - 17118, - 17119 - }, - { - 17120, - 17121, - 17122, - 17123, - 17124 - }, - { - 17125, - 17126, - 17127, - 17128, - 17129 - } + { 17095, 17096, 17097, 17098, 17099 }, + { 17100, 17101, 17102, 17103, 17104 }, + { 17105, 17106, 17107, 17108, 17109 }, + { 17110, 17111, 17112, 17113, 17114 }, + { 17115, 17116, 17117, 17118, 17119 }, + { 17120, 17121, 17122, 17123, 17124 }, + { 17125, 17126, 17127, 17128, 17129 } }; + // @formatter:on // Spawns - private static final int[][] _spawns = + private static final Location[] SPAWNS = { + new Location(-84139, 243145, -3704, 8473), + new Location(-119702, 44557, 360, 33023), + new Location(45413, 48351, -3056, 50020), + new Location(115607, -177945, -896, 38058), + new Location(12086, 16589, -4584, 3355), + new Location(-45032, -113561, -192, 32767), + new Location(-83112, 150922, -3120, 2280), + new Location(-13931, 121938, -2984, 30212), + new Location(87127, -141330, -1336, 49153), + new Location(43520, -47590, -792, 43738), + new Location(148060, -55314, -2728, 40961), + new Location(82801, 149381, -3464, 53707), + new Location(82433, 53285, -1488, 22942), + new Location(147059, 25930, -2008, 56399), + new Location(111171, 221053, -3544, 2058), + new Location(15907, 142901, -2688, 14324), + new Location(116972, 77255, -2688, 41951) + }; + + public PriestOfBlessing(String name, String descr) + { + super(name, descr); + + addStartNpc(PRIEST); + addFirstTalkId(PRIEST); + addTalkId(PRIEST); + if (!SPAWNED) { - -84139, - 243145, - -3704, - 8473 - }, - { - -119702, - 44557, - 360, - 33023 - }, - { - 45413, - 48351, - -3056, - 50020 - }, - { - 115607, - -177945, - -896, - 38058 - }, - { - 12086, - 16589, - -4584, - 3355 - }, - { - -45032, - -113561, - -192, - 32767 - }, - { - -83112, - 150922, - -3120, - 2280 - }, - { - -13931, - 121938, - -2984, - 30212 - }, - { - 87127, - -141330, - -1336, - 49153 - }, - { - 43520, - -47590, - -792, - 43738 - }, - { - 148060, - -55314, - -2728, - 40961 - }, - { - 82801, - 149381, - -3464, - 53707 - }, - { - 82433, - 53285, - -1488, - 22942 - }, - { - 147059, - 25930, - -2008, - 56399 - }, - { - 111171, - 221053, - -3544, - 2058 - }, - { - 15907, - 142901, - -2688, - 14324 - }, - { - 116972, - 77255, - -2688, - 41951 + for (Location spawn : SPAWNS) + { + addSpawn(PRIEST, spawn, false, 0); + } + SPAWNED = true; } - }; + } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - QuestState st = player.getQuestState(getName()); - if (st == null) - { - return null; - } - if (event.equalsIgnoreCase("buy_voice")) { - if (st.getQuestItemsCount(57) >= _price_voice) + if (player.getAdena() >= PRICE_VOICE) { String value = loadGlobalQuestVar(player.getAccountName() + "_voice"); long _reuse_time = value == "" ? 0 : Long.parseLong(value); if (System.currentTimeMillis() > _reuse_time) { - st.setState(State.STARTED); - st.takeItems(57, _price_voice); - st.giveItems(_nevit_voice, 1); + takeItems(player, PcInventory.ADENA_ID, PRICE_VOICE); + giveItems(player, NEVIT_VOICE, 1, -1); saveGlobalQuestVar(player.getAccountName() + "_voice", Long.toString(System.currentTimeMillis() + (20 * 3600000))); } else @@ -239,7 +122,7 @@ public class PriestOfBlessing extends Quest int hours = (int) (remainingTime / 3600); int minutes = (int) ((remainingTime % 3600) / 60); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES); - sm.addItemName(_nevit_voice); + sm.addItemName(NEVIT_VOICE); sm.addNumber(hours); sm.addNumber(minutes); player.sendPacket(sm); @@ -251,21 +134,19 @@ public class PriestOfBlessing extends Quest else if (event.equalsIgnoreCase("buy_hourglass")) { int _index = getHGIndex(player.getLevel()); - int _price_hourglass = _prices_hourglass[_index]; + int _price_hourglass = PRIEVE_HOURGLASS[_index]; - if (st.getQuestItemsCount(57) >= _price_hourglass) + if (player.getAdena() >= _price_hourglass) { String value = loadGlobalQuestVar(player.getAccountName() + "_hg_" + _index); long _reuse_time = value == "" ? 0 : Long.parseLong(value); if (System.currentTimeMillis() > _reuse_time) { - int[] _hg = _hourglasses[_index]; + int[] _hg = HOURGLASSES[_index]; int _nevit_hourglass = _hg[getRandom(0, _hg.length - 1)]; - - st.setState(State.STARTED); - st.takeItems(57, _price_hourglass); - st.giveItems(_nevit_hourglass, 1); + takeItems(player, PcInventory.ADENA_ID, _price_hourglass); + giveItems(player, _nevit_hourglass, 1, -1); saveGlobalQuestVar(player.getAccountName() + "_hg_" + _index, Long.toString(System.currentTimeMillis() + (20 * 3600000))); } else @@ -289,15 +170,10 @@ public class PriestOfBlessing extends Quest @Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { - QuestState st = player.getQuestState(getName()); - if (st == null) - { - st = newQuestState(player); - } final NpcHtmlMessage html = new NpcHtmlMessage(0); final String content = getHtm(player.getHtmlPrefix(), "32783.htm"); html.setHtml(content); - html.replace("%donate%", Util.formatAdena(_prices_hourglass[getHGIndex(player.getLevel())])); + html.replace("%donate%", Util.formatAdena(PRIEVE_HOURGLASS[getHGIndex(player.getLevel())])); player.sendPacket(html); return null; } @@ -336,25 +212,8 @@ public class PriestOfBlessing extends Quest return index; } - public PriestOfBlessing(int questId, String name, String descr) - { - super(questId, name, descr); - - addStartNpc(_priest); - addFirstTalkId(_priest); - addTalkId(_priest); - if (!_spawned) - { - for (int[] _spawn : _spawns) - { - addSpawn(_priest, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0); - } - _spawned = true; - } - } - public static void main(String[] args) { - new PriestOfBlessing(-1, "PriestOfBlessing", "retail"); + new PriestOfBlessing(PriestOfBlessing.class.getSimpleName(), "ai/npc/"); } } diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/documentation.txt b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/documentation.txt deleted file mode 100644 index 939a8e7d1998b89d2d1f185c136390cb0c5d9c95..0000000000000000000000000000000000000000 --- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/documentation.txt +++ /dev/null @@ -1,7 +0,0 @@ -jscript/teleports is used for definitions of teleports that are too advanced to be done under normal means. -For example, teleporting to the race track allows a player a free teleport and a free return to the SAME -city from which the player went to the race track. Normal teleports do not store any information about -the origin. In order to achieve this special teleportation, a teleport script is needed. - -Teleport scripts are essentially dummy quests, hidden from the client. All implementation details are -fully covered by quests. For more info, please see the documentation in "scripts/quests/documentation.txt" \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/package-info.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..f8811103ed7037454d226b3504a19d34b7bc22da --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/package-info.java @@ -0,0 +1,25 @@ +/* + * 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/>. + */ + +/** + * Teleporter AIs are used for teleports that are too advanced to be done under normal means.<br> + * For example, teleporting to the race track allows a player a free teleport and a free return to the same city from which the player went to the race track.<br> + * Normal teleports do not store any information about the origin.<br> + * In order to achieve this special teleportation, a teleport script is needed.<br> + * <br> + * All implementation details are fully covered by quests.<br> + * @author Zoey76 + */ +package ai.npc.Teleports; \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/documentation.txt b/L2J_DataPack_BETA/dist/game/data/scripts/custom/documentation.txt deleted file mode 100644 index 6eebb9a56b1a7c36cc2ad6d683eac7d9a0d0734d..0000000000000000000000000000000000000000 --- a/L2J_DataPack_BETA/dist/game/data/scripts/custom/documentation.txt +++ /dev/null @@ -1,9 +0,0 @@ -Jython scripts added in the custom folder define quests and/or AI that are not normally part of -the original Lineage 2 game. - -In addition, "custom" is sometimes used as a temporary implementation of aspects of the original -game that are not yet fully implementable by L2J. In this manner, partially accurate emulation -may be offered until a better method is implemented. - -The mechanics and syntax of custom scripts are the same as all quest scripts. For more -details, please see "scripts/quests/documentation.txt" \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/package-info.java b/L2J_DataPack_BETA/dist/game/data/scripts/custom/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..9d7b170a23f50f4b5ca0b22cd7bcfd2da27c3aeb --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/package-info.java @@ -0,0 +1,23 @@ +/* + * 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/>. + */ + +/** + * Scripts added in the custom folder define quests and/or AI that are not normally part of the original Lineage 2 game.<br> + * In addition, "custom" is sometimes used as a temporary implementation of aspects of the original game that are not yet fully implementable by L2J.<br> + * In this manner, partially accurate emulation may be offered until a better method is implemented.<br> + * The mechanics and syntax of custom scripts are the same as all quest scripts. + * @author Zoey76 + */ +package custom; \ No newline at end of file