Jump to content
  • 0

VIP Npc


Question

9 answers to this question

Recommended Posts

  • 0
Posted

So you need NPC with possibility to confer the status of VIP?

 

Why python? It could be java quest based NPC aswell.

  • 0
Posted

Not tested, but should be fine, fast code:

 

package custom.VipManager;

import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;

/**
* @author Matim
* @version 1.0
*/
public class VipManager extends Quest
{
private final static String qn = "VipManager";

private final static int NPC = 50013;

public VipManager(int questId, String name, String descr)
{
	super(questId, name, descr);
	addFirstTalkId(NPC);
	addStartNpc(NPC);
	addTalkId(NPC);
}

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";

	String name = player.getName();

	if (event.equalsIgnoreCase("1"))
	{
		if (player.isVip()) // TODO u need this Cheack! 
		{
			htmltext = "<html><title>VIP Manager</title><head><body><center>" +
			           "<br>Sorry <font color=\"LEVEL\">" + name + "</font>, but you are already VIP!";
		}
		else
		{	
			if (player.getInventory().getItemByItemId(6630) == null)
			{
				return "error";
			}
			else
			{	
				if if (player.getLevel() < 80)
				{
					player.sendMessage("You need Level 80 or higher!");
				}
				else
				{
					player.setIsVip(true); // TODO u need this method to set VIP! 

					htmltext = "<html><title>VIP Manager</title><head><body><center>" +
			                   "<br>Congratulations <font color=\"LEVEL\">" + name + "</font>, you are VIP now!";
				}
			}
		}
	}

	else	
		htmltext = "Error, check whole NPC code!";
	return htmltext;
}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState qs = player.getQuestState(qn);
	if (qs == null)
		qs = newQuestState(player);

	htmltext = "<html><title></title><head><body><center>" +
			   "<br><img src=l2ui.bbs_lineage2 height=16 width=80>" +
			   "<font color=AAAAAA>VIP Manager</font><br>" +
                   "<img src=L2UI_CH3.herotower_deco width=256 height=32>" +
                   
                   "<button value=\"Make me VIP!\" action=\"bypass -h Quest VipManager 1\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +

			   "<font color=\"cc9900\"><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></font><br1></center></body></head></html>";
			   
	return htmltext;
}

public static void main(String[] args)
{
	new VipManager(-1, qn, "custom");
}
}

 

Warning, you need:

 

isVip(); boolean check (check if is/isnt Vip)

 

setIsVip(boolean b); to make player VIP

 

Maybe your pack has support for VIP engine, I guess it has since you need it.

 

I guess you know, how to install it, right?

  • 0
Posted

matim, on code you write:

				if if (player.getLevel() < 80)
				{
					player.sendMessage("You need Level 80 or higher!");
				}

i mean the double ifs :D

 

 

edit: sorry i didn't see date

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

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..