Skip to content

Instantly share code, notes, and snippets.

@Battlecruiser
Last active August 29, 2015 14:17
Show Gist options
  • Save Battlecruiser/8b5390dd37ef73369606 to your computer and use it in GitHub Desktop.
Save Battlecruiser/8b5390dd37ef73369606 to your computer and use it in GitHub Desktop.
diff --git a/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/NoblesseManager.java b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/NoblesseManager.java
new file mode 100644
index 0000000..98e1956
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/NoblesseManager.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2004-2015 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 custom.NoblesseManager;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.enums.ChatType;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.network.serverpackets.SocialAction;
+
+/**
+ * Noblesse Manager AI.
+ * @author Gladicek
+ */
+
+public final class NoblesseManager extends AbstractNpcAI
+{
+ // Npc
+ private static final int NOBLESSE_MANAGER = 33229; // Make your own npc and edit this line
+ // Items
+ private static final int ITEM = 6673; // Default: Festival Adena
+ private static final int NOBLESS_TIARA = 7694;
+ // Price
+ private static final int PRICE = 10; // Set how much noblesse will cost
+ // Level check
+ private static final int MIN_LEVEL = 75; // You can edit here minimal level
+
+ private NoblesseManager()
+ {
+ super(NoblesseManager.class.getSimpleName(), "custom");
+ addStartNpc(NOBLESSE_MANAGER);
+ addFirstTalkId(NOBLESSE_MANAGER);
+ addTalkId(NOBLESSE_MANAGER);
+ }
+
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+ String htmltext = null;
+ {
+ if (!player.isNoble())
+ {
+ final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
+ packet.setHtml(getHtm(player.getHtmlPrefix(), "noblesse-yes.html"));
+ packet.replace("%level%", MIN_LEVEL);
+ packet.replace("%price%", PRICE);
+ player.sendPacket(packet);
+ }
+ else
+ {
+ htmltext = "noblesse-already.html";
+ }
+ }
+ return htmltext;
+ }
+
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ String htmltext = null;
+
+ if (event.equals("noblesse"))
+ {
+ if (hasQuestItems(player, ITEM, PRICE) || (player.getLevel() >= MIN_LEVEL))
+ {
+ takeItems(player, ITEM, PRICE);
+ giveItems(player, NOBLESS_TIARA, 1);
+ player.setNoble(true);
+ player.sendPacket(new SocialAction(player.getObjectId(), 3));
+ broadcastNpcSay(npc, ChatType.NPC_WHISPER, "Congratulations! You are now Noblesse!");
+ }
+ else
+ {
+ htmltext = "noblesse-no.html";
+ }
+ }
+ return htmltext;
+ }
+
+ public static void main(String[] args)
+ {
+ new NoblesseManager();
+ }
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-already.html b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-already.html
new file mode 100644
index 0000000..332febd
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-already.html
@@ -0,0 +1,3 @@
+<html><body>Noblesse Manager:<br>
+Sorry, but you are already <font color="FFFF00">Noblesse</font>!
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-no.html b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-no.html
new file mode 100644
index 0000000..c1e708b
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-no.html
@@ -0,0 +1,3 @@
+<html><body>Noblesse Manager:<br>
+Sorry, but you don't meet minimal requirements!
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-yes.html b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-yes.html
new file mode 100644
index 0000000..ec5c13f
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/NoblesseManager/noblesse-yes.html
@@ -0,0 +1,7 @@
+<html><body>Noblesse Manager:<br>
+When you become <font color="FFFF00">Noblesse</font>, you can fight in olympiad games and have chance to become a <font color="FFFF00">Hero</font>!<br>
+Only what you need is <font color="55FFFF">%price%</font> Festival Adena and your level must be atleast <font color="55FFFF">%level%</font>!
+<center>
+<button action="bypass -h Quest NoblesseManager noblesse" value="Give me Noblesse" width=250 height=26 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
+</center>
+</body></html>
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment