Jump to content

Recommended Posts

Posted

Hello Everyone!!!

An npc like this was requested by a user(i am lying no one requests from me  :alone: )  :LOL: so i am sharing it here!!!

 

Core Side

Index: E:/l2jdev/l2rebellion/workspace/L2jHellasC/config/Mods/L2JHellas.ini
===================================================================
--- E:/l2jdev/l2rebellion/workspace/L2jHellasC/config/Mods/L2JHellas.ini	(revision 104)
+++ E:/l2jdev/l2rebellion/workspace/L2jHellasC/config/Mods/L2JHellas.ini	(working copy)
@@ -6,6 +6,14 @@
# example: "Announce: Hi All [inspector]"  
AnnounceGmName = False

+#Nobless Npc.This Npc makes you nobless for an item count of your choise
+#Enable Nob npc?
+Allownobnpc = True
+#Item id for nobless
+NobItem = 3470
+#How many items should be removed for nobless status?
+NobCount = 1
+
# GM over enchant protection  
# if GM give more than X enchanted stuff to a player both get banned  
GMOverEnchant = 0
Index: E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/Config.java
===================================================================
--- E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/Config.java	(revision 104)
+++ E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/Config.java	(working copy)
@@ -637,6 +637,9 @@
	/** Check for bad ID ? */

	// l2jhellas_CONFIG_FILE
+	public static boolean ALLOW_NOB_NPC;
+	public static int NOBLESS_COUNT;
+	public static int NOBLESS_ITEM;
	public static boolean SHOW_NPC_CREST;
	public static String EMAIL_USER;
	public static String EMAIL_PASS;
@@ -2069,6 +2072,9 @@
				CHAMPION_SPCL_ITEM = Integer.parseInt(L2JHellasSettings.getProperty("ChampionSpecialItemID", "6393"));
				CHAMPION_SPCL_QTY = Integer.parseInt(L2JHellasSettings.getProperty("ChampionSpecialItemAmount", "1"));
				CHAMPION_SPCL_LVL_DIFF = Integer.parseInt(L2JHellasSettings.getProperty("ChampionSpecialItemLevelDiff", "0"));
+				ALLOW_NOB_NPC = Boolean.parseBoolean(L2JHellasSettings.getProperty("Allownobnpc", "True"));
+				NOBLESS_ITEM = Integer.parseInt(L2JHellasSettings.getProperty("NobItem", "3470"));
+				NOBLESS_COUNT = Integer.parseInt(L2JHellasSettings.getProperty("NobCount", "1"));
				SHOW_NPC_CREST = Boolean.parseBoolean(L2JHellasSettings.getProperty("ShowNpcCrest", "False"));
				ALLOW_CLASS_MASTER = Boolean.valueOf(L2JHellasSettings.getProperty("AllowClassMaster", "False"));
				ALLOW_REMOTE_CLASS_MASTER = Boolean.valueOf(L2JHellasSettings.getProperty("AllowRemoteClassMaster", "False"));
Index: E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2NoblessInstance.java
===================================================================
--- E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2NoblessInstance.java	(revision 0)
+++ E:/l2jdev/l2rebellion/workspace/L2jHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2NoblessInstance.java	(revision 0)
@@ -0,0 +1,120 @@
+/*
+ * 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 com.l2jhellas.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+import com.l2jhellas.Config;
+import com.l2jhellas.gameserver.ai.CtrlIntention;
+import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jhellas.gameserver.network.serverpackets.ActionFailed;
+import com.l2jhellas.gameserver.network.serverpackets.MyTargetSelected;
+import com.l2jhellas.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jhellas.gameserver.network.serverpackets.SocialAction;
+import com.l2jhellas.gameserver.network.serverpackets.ValidateLocation;
+import com.l2jhellas.gameserver.templates.L2NpcTemplate;
+import com.l2jhellas.util.Rnd;
+
+
+/** Nobless Manager */
+public class L2NoblessInstance extends L2FolkInstance
+{
+	
+	public int item = Config.NOBLESS_ITEM,count = Config.NOBLESS_COUNT;
+	public L2NoblessInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+    }
+
+	private final static Logger _log = Logger.getLogger(L2NoblessInstance.class.getName());
+
+    @Override
+    public void onBypassFeedback(L2PcInstance player, String command)
+    {
+    	player.sendPacket(new ActionFailed());
+	    StringTokenizer st = new StringTokenizer(command, " ");
+	    String actualCommand = st.nextToken();
+	    @SuppressWarnings("unused")
+		String val = "";
+	    if (st.countTokens() >= 1)
+	    {
+	        val = st.nextToken();
+	    }
+	    if (actualCommand.equalsIgnoreCase("setnobless"))
+	    {
+	    	if(!(player instanceof L2PcInstance))
+                return;
+            L2PcInstance activeChar = player;
+            if(activeChar.isNoble())
+            {
+                activeChar.sendMessage("You Are Already A Noblesse!.");
+            }
+            else if(!Config.ALLOW_NOB_NPC)
+            {
+            	activeChar.sendMessage("Admin has disabled this npc!");
+            }
+            else if(Config.ALLOW_NOB_NPC && (activeChar.getInventory().getInventoryItemCount(item, - count) >= 0))
+            {
+            	activeChar.destroyItemByItemId("Nobless", item, count, activeChar, true);
+            	activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
+                activeChar.setNoble(true);
+                activeChar.sendMessage("You Are Now a Noble,You Are Granted With Noblesse Status , And Noblesse Skills.");
+                activeChar.broadcastUserInfo();
+                activeChar.getInventory().addItem("Tiara", 7694, 1, activeChar, null);
+            }
+            
+	    }
+	    else
+	    {
+	    	super.onBypassFeedback(player, command);
+	    }
+    }
+
+    @Override
+    public void onAction(L2PcInstance player)
+    {
+	    if (this != player.getTarget())
+	    {
+	        player.setTarget(this);
+	        player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
+	        player.sendPacket(new ValidateLocation(this));
+	    }
+	    else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))
+	    {
+	        SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
+	        broadcastPacket(sa);
+	        player.setLastFolkNPC(this);
+	        showMessageWindow(player);
+	        player.sendPacket(new ActionFailed());
+	    }
+	    else
+	    {
+	        player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
+	        player.sendPacket(new ActionFailed());
+	    }
+    }
+
+    private void showMessageWindow(L2PcInstance player)
+    {
+	    NpcHtmlMessage html = new NpcHtmlMessage(1);
+	    html.setFile("data/html/mods/Nobless.htm");
+	    html.replace("%objectId%", String.valueOf(getObjectId()));
+	    html.replace("%npcname%", getName());
+	    player.sendPacket(html);
+    }
+    
+    
+    }
\ No newline at end of file

 

Now go to data/html/mods like a  :good sir: (if mods folder doesn't exist just create one)

and put this html

<html><title>Nobless Manager</title>
<body>
<center>
<br>
<center><a action="bypass -h npc_%objectId%_setnobless">Give Me Noblesse Status</a><BR></center>
<BR>
<img src="L2UI_CH3.herotower_deco" align="center" width="256" height="32"><br>
</center>
</body>
</html>

 

 

Thanks for watching leave a comment if you like it pm me for private requests!  :gusta:

  • 1 month later...

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
Reply to this topic...

×   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...