Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Npc Simple Delevel Npc

Iniciado por Swarlog, Ago 11, 2022, 01:32 AM

Tema anterior - Siguiente tema

Swarlog

--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/delevelnpc/delevelnpc.java
@@ -0,0 +1,101 @@
+/*
+ * 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.delevelnpc;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.datatables.ExperienceTable;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Eze
+ */
+public class delevelnpc extends AbstractNpcAI
+{
+ private final int npcId = 1000010;
+ private final int itemcantidad = 15;
+ private final int itemid = 6392;
+
+ public delevelnpc()
+ {
+ super(delevelnpc.class.getSimpleName(), "custom");
+
+ addStartNpc(npcId);
+ addFirstTalkId(npcId);
+ addTalkId(npcId);
+
+ }
+
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+
+ return "main.htm";
+ }
+
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ String htmlText = event;
+
+ if (event.equalsIgnoreCase("delevel"))
+ {
+ try
+ {
+ if (player.getLevel() <= 1)
+ {
+ return htmlText = "Eres lvl 1 no puedes bajar mas.";
+ }
+ if ((player.getLevel() <= 40) && player.isSubClassActive())
+ {
+ return htmlText = "Eres lvl 40 no puedes bajar mas estando en subclass.";
+ }
+ if (player.getInventory().getInventoryItemCount(itemid, -1) < itemcantidad)
+ {
+ player.sendMessage("Incorrect item count.");
+ return htmlText = null;
+ }
+
+ long expplayer = player.getExp();
+ long exp = ExperienceTable.getInstance().getExpForLevel(player.getLevel() - 1);
+
+ takeItems(player, itemid, itemcantidad);
+
+ player.removeExpAndSp(expplayer - exp, 0);
+
+ player.sendMessage(itemcantidad + " event medalls han sido eliminados");
+ player.sendMessage("Has bajado un level.");
+
+ htmlText = null;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return htmlText;
+ }
+
+ public static void main(String[] args)
+ {
+ new delevelnpc();
+ }
+}
\ No newline at end of file
--------------------------------------------------------------------------------------------------------------------------------
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/stats/npcs/custom/delevel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/npcs.xsd">
+ <npc id="1000010" displayId="32107" name="Delevel" usingServerSideName="true" title="Npc" usingServerSideTitle="true" type="L2Npc">
+ <collision>
+ <radius normal="40" />
+ <height normal="80" />
+ </collision>
+ </npc>
+</list>
\ No newline at end of file
--------------------------------------------------------------------------------------------------------------------------------------
--- a/L2J_DataPack/dist/game/data/scripts.cfg
+++ b/L2J_DataPack/dist/game/data/scripts.cfg
@@ -323,3 +323,5 @@
 #events/FreyaCelebration/FreyaCelebration.java
 #events/MasterOfEnchanting/MasterOfEnchanting.java
 #events/LoveYourGatekeeper/LoveYourGatekeeper.java
+
+custom/delevelnpc/delevelnpc.java
\ No newline at end of file
-------------------------------------------------------------------------------------------------------------------------------------
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/delevelnpc/main.htm
@@ -0,0 +1,11 @@
+<html>
+ <head>
+ <title>Delevel</title>
+ </head>
+ <body>
+ <center>
+ Hola aventurero. Quieres bajar un level?<br> Tu experiencia volvera a 0.<br> Te costara 15 event-medalls. <br>
+ <button action="bypass -h Quest delevelnpc delevel" value="Bajar 1 level" width=200 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF" />
+ </center>
+ </body>
+</html>
\ No newline at end of file

Creditos: execanciani