From 55962dbe655488b4841c8a85577dab52c0479ed2 Mon Sep 17 00:00:00 2001 From: malyelfik <malyelfik@users.noreply.github.com> Date: Wed, 10 Oct 2012 15:52:22 +0000 Subject: [PATCH] BETA: Updating Fortune Teller AI --- L2J_DataPack_BETA/dist/game/data/scripts.cfg | 2 +- .../ai/npc/FortuneTelling/FortuneTelling.java | 60 +++++++++ .../npc}/FortuneTelling/fortune.htm | 4 +- .../npc}/FortuneTelling/lowadena.htm | 0 .../custom/FortuneTelling/FortuneTelling.java | 120 ------------------ 5 files changed, 63 insertions(+), 123 deletions(-) create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/FortuneTelling.java rename L2J_DataPack_BETA/dist/game/data/scripts/{custom => ai/npc}/FortuneTelling/fortune.htm (70%) rename L2J_DataPack_BETA/dist/game/data/scripts/{custom => ai/npc}/FortuneTelling/lowadena.htm (100%) delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/FortuneTelling.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg index c139ffbbd5..3e3737fcc7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg +++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg @@ -15,6 +15,7 @@ ai/npc/DragonVortex/DragonVortex.java ai/npc/ForgeOfTheGods/ForgeOfTheGods.java ai/npc/ForgeOfTheGods/Rooney.java ai/npc/ForgeOfTheGods/TarBeetle.java +ai/npc/FortuneTelling/FortuneTelling.java ai/npc/NpcBuffers/BirthdayCake.java ai/npc/NpcBuffers/CabaleBuffer.java ai/npc/NpcBuffers/ChristmasTree.java @@ -715,7 +716,6 @@ quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java # Custom -custom/FortuneTelling/FortuneTelling.java custom/Nottingale/Nottingale.java custom/EchoCrystals/EchoCrystals.java custom/ShadowWeapons/ShadowWeapons.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/FortuneTelling.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/FortuneTelling.java new file mode 100644 index 0000000000..b88eeafa6a --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/FortuneTelling.java @@ -0,0 +1,60 @@ +/* + * 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.npc.FortuneTelling; + +import ai.npc.AbstractNpcAI; + +import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.itemcontainer.PcInventory; + +/** + * Fortune Telling AI.<br> + * Original Jython script by Kerberos. + * @authors Nyaran + */ +public class FortuneTelling extends AbstractNpcAI +{ + private static final int NPC_ID = 32616; + private static final int COST = 1000; + + public FortuneTelling(String name, String descr) + { + super(name, descr); + addStartNpc(NPC_ID); + addTalkId(NPC_ID); + } + + @Override + public String onTalk(L2Npc npc, L2PcInstance player) + { + String htmltext = getNoQuestMsg(player); + if (player.getAdena() < 1000) + { + htmltext = "lowadena.htm"; + } + else + { + takeItems(player, PcInventory.ADENA_ID, COST); + htmltext = getHtm(player.getHtmlPrefix(), "fortune.htm").replace("%fortune%", "<fstring>" + (1800309 + getRandom(386)) + "</fstring>"); + } + return htmltext; + } + + public static void main(String args[]) + { + new FortuneTelling(FortuneTelling.class.getSimpleName(), "ai/npc"); + } +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/fortune.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/fortune.htm similarity index 70% rename from L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/fortune.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/fortune.htm index 68336bc172..d51332f30f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/fortune.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/fortune.htm @@ -1,6 +1,6 @@ <html><body>Fortune-Teller Mine:<br> I see an image approaching before you... It is difficult to put what I saw into words.<br> -How can I say this? Okay, listen closely:<br><br> -<center>%fortune%.</center><br><br> +How can I say this? Okay, listen closely:<br> +<center>%fortune%</center><br><br> Take these words to heart. You should seriously consider the meaning... </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/lowadena.htm b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/lowadena.htm similarity index 100% rename from L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/lowadena.htm rename to L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/FortuneTelling/lowadena.htm diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/FortuneTelling.java b/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/FortuneTelling.java deleted file mode 100644 index 547e3c8857..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/scripts/custom/FortuneTelling/FortuneTelling.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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 custom.FortuneTelling; - -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.network.serverpackets.NpcHtmlMessage; - -/** - * Fortune Telling AI.<br> - * Original Jython script by Kerberos. - * @authors Nyaran - */ -public class FortuneTelling extends Quest -{ - private static final String qn = "FortuneTelling"; - - private static final int ADENA = 57; - private static final int COST = 1000; - - private static final int NPC = 32616; - - private static final String[] FORTUNE = - { - "What you\'ve endured will return as a benefit.", - "The dragon now acquires an eagle\'s wings.", - "Be warned as you may be overwhelmed by surroundings if you lack a clear opinion.", - "A new trial or start may be successful as luck shadows changes.", - "You may feel nervous and anxious because of unfavorable situations.", - "You may meet the person you\'ve longed to see.", - "You may meet many new people but it will be difficult to find a perfect person who wins your heart.", - "Good fortune and opportunity may lie ahead as if one's born in a golden spoon.", - "Be confident and act tenaciously at all times. You may be able to accomplish to perfection during somewhat unstable situations.", - "There may be an occasion where you are consoled by people.", - "Be independent at all times.", - "Do not loosen up with your precautions.", - "Closely observe people who pass by since you may meet a precious person who can help you.", - "Listen to the advice that's given to you with a humble attitude.", - "Focus on networking with like-minded people. They may join you for a big mission in the future.", - "Staying busy rather than being stationary will help.", - "You may lose your drive and feel lost.", - "People around you will encourage your every task in the future.", - "Be kind to and care for those close to you, they may help in the future.", - "Your ambition and dream will come true.", - "Your value will shine as your potential is finally realized.", - "If you keep smiling without despair, people will come to trust you and offer help.", - "There may be a little loss, but think of it as an investment for yourself.", - "The difficult situations will turn to hope with unforeseen help.", - "Impatience may lie ahead as the situation is unfavorable.", - "Be responsible with your tasks but do not hesitate to ask for colleagues\' help.", - "You may fall in danger each time when acting upon improvisation.", - "A determined act after prepared research will attract people.", - "A rest will promise a bigger development.", - "You will be rewarded for your efforts and accomplishments.", - "There are many things to consider after encountering hindrances.", - "Consider other\'s situations and treat them sincerely at all times.", - "A comparison to others may be helpful.", - "Be cautious to control emotions as temptations are nearby.", - "Momentarily delay an important decision.", - "Be confident and act tenaciously at all times. You may be able to accomplish to perfection during somewhat unstable situations.", - "Visiting a place you\'ve never been before may bring luck.", - "What used to be well managed may stumble one after another.", - "Your steady pursuit of new information and staying ahead of others will raise your value.", - "Being neutral is a good way to go, but clarity may be helpful contrary to your hesitance.", - "Skillful evasion is needed when dealing with people who pick fights as a disaster may arise from it.", - "Small things make up big things so even value trivial matters.", - "Bigger mistakes will be on the road if you fail to correct a small mistake.", - "Momentarily delay an important decision.", - "A remedy is on its way for a serious illness." - }; - - public FortuneTelling(int questId, String name, String descr) - { - super(questId, name, descr); - addStartNpc(NPC); - addTalkId(NPC); - } - - @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - QuestState st = player.getQuestState(qn); - NpcHtmlMessage html = new NpcHtmlMessage(1); - String PARENT_DIR = "data/scripts/custom/FortuneTelling/"; - - if (st == null) - return null; - - if (st.getQuestItemsCount(ADENA) < COST) - html.setFile(player.getHtmlPrefix(), PARENT_DIR + "lowadena.htm"); - else - { - st.takeItems(ADENA, COST); - html.setFile(player.getHtmlPrefix(), PARENT_DIR + "fortune.htm"); - html.replace("%fortune%", FORTUNE[getRandom(FORTUNE.length)]); - } - st.exitQuest(true); - player.sendPacket(html); - return null; - } - - public static void main(String args[]) - { - new FortuneTelling(-1, qn, "custom"); - } -} -- GitLab