Jump to content
  • 0

[Help] Noblesse Only Shop


Question

Posted

Hey!

 

Is it possible to do a shop that only noblesse players can use?

I know that teleports has it's own noblesse section. So it should be, but I'm not sure how to do it.

 

<a action="bypass -h npc_%objectId%_Quest 2000_NoblesseTeleport">Noblesse Exclusive Teleport</a><br>

 

That's the htm code from a teleporter..

 

If you know how to do this, please give me a guide =)

6 answers to this question

Recommended Posts

  • 0
Posted

A java instance :

+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * <http://www.gnu.org/copyleft/gpl.html>
+ */
+package com.l2jserver.gameserver.model.actor.instance;
+
+import javolution.text.TextBuilder;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
+
+/**
+ * @author  xLuc1 a.k.a DominiQue
+ */
+public class L2NobleInstance extends L2Npc
+{
+	private String filename;
+	public L2NobleInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+
+	@Override
+	public void onBypassFeedback(L2PcInstance player, String command) {
+		
+		if(player == null || player.getLastFolkNPC() == null 
+				|| player.getLastFolkNPC().getObjectId() != this.getObjectId()) {
+			return;
+		}
+				
+		if(command.startsWith("playmefirst"))
+			redname(player);		
+	}
+	
+	public static void noble(L2PcInstance player)
+	{
+		player.setNoble(true);
+	}	
+	
+	
+	@Override
+	public void showChatWindow(L2PcInstance player, int val) 
+	{
+		filename = (getHtmlPath(getNpcId(), val));
+		NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+		msg.setHtml(colorWindow(player));
+		msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+		player.sendPacket(msg);
+	}
+	private String colorWindow(L2PcInstance player) 
+	{
+		TextBuilder tb = new TextBuilder();
+
+			tb.append("<html><title>xLuc1</title><body>");
+			    tb.append("<center>");
+			    tb.append("<br>");
+			    tb.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\"><br>");
+			    tb.append("Welcome "+player.getName()+"<br>");
+			    tb.append("<tr><td>I can make u a noble !</td></tr><br>");  
+			    tb.append("<img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\"></center><br>"); 
+			    tb.append("<br>");
+			    tb.append("<center>"); 
+			    tb.append("<button value= Noble action=\"bypass -h npc_%objectId%_playmefirst\" width=130 height=25 back= L2UI_ct1.button_df fore = L2UI_ct1.button_df>"); 
+			    tb.append("<center>");       
+			    tb.append("<center><img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\">");
+			    tb.append("</body></html>");
+		return tb.toString();
+	}
+	
+}

  • 0
Posted

if you have a non custom gk ... the server allready have a teleport for nobless  players at evry gatekeeper you can simply change the html from there....

but if you have a custom gk i recomand to make/ask for a script gk ...is no't hard to make one ....

here is a simple idea :

	def onEvent(self,event,st):
        htmltext = event
         if st.getPlayer().isNobless() :
		htmltext = "nobless.htm"
         else:    
                       htmltext = "nonnobless.htm"     
         return htmltext  

 

  • 0
Posted

since u show

<a action="bypass -h npc_%objectId%_Quest 2000_NoblesseTeleport">Noblesse Exclusive Teleport</a><br>

 

u can also use this too... with a bit rewrite... so if u don't want to do it in java try it.

 

gameserver\data\scripts\teleports\2000_NoblesseTeleport

c/p to

gameserver\data\scripts\custom\2000_NoblesseTeleport

rename it

999_NoblesseShop

 

 

gameserver\data  open scripts.cfg and add under custom:    custom/999_NoblesseShop/__init__.py

 

 

 

 

didnt tested but could work^^

 

I would really like to do it this way, but it doesn't work.

The npc just say;

"I have nothing to say to you

Quest(link)" and it doesn't link to anything good ^^

 

Any more suggestions?

  • 0
Posted

as i said i didn't test it^^

 

but now i did and its worked :P

 

gameserver\data\scripts\teleports\999_NoblesseShop

__init__.py

# Created by Ham Wong on 2007.02.28

import sys

from com.l2jserver.gameserver.model.quest        import State

from com.l2jserver.gameserver.model.quest        import QuestState

from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest

 

qn = "999_NoblesseShop"

NPC=[your npc ID]

 

html = '<html><title>Gatekeeper</title><body><br>Ah, you\'re a Noblesse! I can offer you a special service then.<br><br><br>\

<table width=280><tr><td align=left width=180><a action="bypass -h npc_%objectId%_Link merchant/NPC ID - PAGE.htm">Armor</a></td></tr></table><br><br>\

        <table width=280><tr><td align=left width=180><a action="bypass -h npc_%objectId%_Link merchant/NPC ID - PAGE.htm">Weapon</a></td></tr></table><br><br>\

<table width=280><tr><td align=left width=180><a action="bypass -h npc_%objectId%_Link merchant/NPC ID - PAGE.htm">Jewely</a></td></tr></table><br><br>\

<br><br><br><br><a action="bypass -h npc_%objectId%_Chat 0">Back</a></body></html>'

 

class Quest (JQuest) :

 

def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 

def onAdvEvent (self,event,npc, player) :

    return event

 

def onTalk (self,npc,player):

    st = player.getQuestState(qn)

    if player.isNoble() == 1 :

      bypass = 'Quest 999_NoblesseShop noble-nopass.htm'

      if st.getQuestItemsCount(13722):

        bypass = 'npc_%objectId%_Chat 44'

      htmltext=html.replace("%bypass%",str(bypass)).replace("%objectId%",str(npc.getObjectId()))

    else :

      htmltext="nobleshop-no.htm"

    return htmltext

 

QUEST      = Quest(-1,qn,"Teleports")

 

for item in NPC:

  QUEST.addStartNpc(item)

  QUEST.addTalkId(item)

 

re-name nobleteleporter-no.htm to nobleshop-no.htm

 

gameserver\data  open scripts.cfg and add under  # Teleports    teleports/999_NoblesseShop/__init__.py

 

set in your merchant the link

<a action="bypass -h npc_%objectId%_Quest 999_NoblesseShop">Enter Noblesse Shop</a>

 

 

enjoy ;)

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