Jump to content

Question

Posted

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

1 answer to this question

Recommended Posts

  • 0
Posted
### 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

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock