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

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