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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...