Skip to content

NPC που πουλαει skills.

Featured Replies

θελω να φτιαξω ενα NPC που να πουλαει καποια Skill απο διαφορα sub και αυτα να κολλανε κανονικα για παντα. Μπορει να μου πει κανεις πως γινεται αυτο?

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2SkillSellerInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2SkillSellerInstance.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2SkillSellerInstance.java	(working copy)
@@ -0,0 +1,64 @@
+/*
+ * 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 net.sf.l2j.gameserver.model.actor.instance;
+
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+
+/**
+ * @author Devlin
+ *
+ */
+public class L2SkillSellerInstance extends L2NpcInstance
+{
+	public L2SkillSellerInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	
+	@Override
+	public void onBypassFeedback(L2PcInstance player, String command)
+	{
+		if (command.equals("skill1"))
+		{
+			L2Skill skill1 = SkillTable.getInstance().getInfo(skillId, level);
+			player.addSkill(skill1, true);
+			player.destroyItem("Devlin.", 57, 1, null, false);
+		}
+	}
+	
+	@Override
+	public void showChatWindow(L2PcInstance player)
+	{
+		mainHtm(player);
+	}
+	
+	private void mainHtm(L2PcInstance player)
+	{
+		NpcHtmlMessage html = new NpcHtmlMessage(5);
+		StringBuilder sb = new StringBuilder("");
+		
+		sb.append("<html><title>Skill Seller</title>");
+		sb.append("<body><center>");
+		sb.append("Choose which skill you want to buy:<br>");
+		sb.append("<a action=\"bypass -h npc_" + getObjectId() + "_skill1\"><font color=\"LEVEL\">Dash</font></a><br>");
+		sb.append("</center></body></html>");
+		
+		html.setHtml(sb.toString());
+		player.sendPacket(html);
+	}
+}
\ No newline at end of file

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.