Jump to content
  • 0

Retail Events Request help.


Question

Posted

paides exw kapoia retails events. ta retails omws ksekinane mona tous. emena mou ta exei se enan fakelo events to java kai ta htm tous. edw einai o java tou heavymedal event. ti prepei na kanw gia na ksekinhsei?

package events.HeavyMedal;

import com.l2jserver.gameserver.instancemanager.QuestManager;
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;
import com.l2jserver.util.Rnd;

/**
** @author Gnacik
**
** Retail Event : 'Heavy Medals'
*/
public class HeavyMedal extends Quest
{
private final static int	CAT_ROY = 31228;
private final static int	CAT_WINNIE = 31229;
private final static int	GLITTERING_MEDAL = 6393;

private final static int	WIN_CHANCE = 50;

private final static int[] MEDALS = { 5,10,20,40 };
private final static int[] BADGES = { 6399,6400,6401,6402 };

public HeavyMedal(int questId, String name, String descr)
{
	super(questId, name, descr);
	addStartNpc(CAT_ROY);
	addStartNpc(CAT_WINNIE);
	addTalkId(CAT_ROY);
	addTalkId(CAT_WINNIE);
	addFirstTalkId(CAT_ROY);
	addFirstTalkId(CAT_WINNIE);
}

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());
	htmltext = event;

	int level = checkLevel(st);

	if (event.equalsIgnoreCase("game"))
	{
		if (st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level])
			return "31229-no.htm";
		else
			return "31229-game.htm";
	}
	else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails"))
	{
		if (st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level])
			return "31229-"+event.toLowerCase()+"-10.htm";

		st.takeItems(GLITTERING_MEDAL, MEDALS[level]);

		if(Rnd.get(100) > WIN_CHANCE)
		{
			level = 0;
		}
		else
		{
			if (level>0)
				st.takeItems(BADGES[level-1], -1);
			st.giveItems(BADGES[level], 1);
			st.playSound("Itemsound.quest_itemget");
			level++;
		}
		return "31229-"+event.toLowerCase()+"-"+String.valueOf(level)+".htm";
	}
	else if (event.equalsIgnoreCase("talk"))
	{
		return String.valueOf(npc.getNpcId())+ "-lvl-"+String.valueOf(level)+".htm";
	}
	return htmltext;
}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	QuestState st = player.getQuestState(getName());
	if (st == null)
	{
		Quest q = QuestManager.getInstance().getQuest(getName());
		st = q.newQuestState(player);
	}
	return npc.getNpcId()+".htm";
}

public int checkLevel(QuestState st)
{
	int _lev = 0;
	if(st == null)
		return 0;
	else if (st.getQuestItemsCount(6402) > 0)
		_lev = 4;
	else if (st.getQuestItemsCount(6401) > 0)
		_lev = 3;
	else if (st.getQuestItemsCount(6400) > 0)
		_lev = 2;
	else if (st.getQuestItemsCount(6399) > 0)
		_lev = 1;

	return _lev;
}

public static void main(String[] args)
{
	new HeavyMedal(-1, "HeavyMedal", "events");
}
}

 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.



  • Posts

    • Hello, I'm looking for classic client for l2 gold or l2 gold weapons for classic 166 version
    • Good afternoon   ⚡CAN'T GO TO THE ONLINE STORE? OPEN THE SITE VIA VPN OR TOR BROWSER⚡ ⚡PREMIUM QUALITY ACCOUNTS, INSTANT DELIVERY, FREE CONSULTATIONS, RELIABLE WORK⚡   ✔ Ready accounts ✔   BUSINESS ACCOUNTS ☟ Blackcatcard Business LV, Volet com (AdvCash) Business EU, Xapo Bank Business EU, Finom Business, PayPal Business, Payset Business, Stripe Business, Payoneer Business EU, Wise Business UK/EU, Revolut Business EU/UK, N26 Business DE, Wallester Business EU, Mistertango Business LV   BANKS, NATIONAL BANKS ☟ Ceska Sporitelna, KASIKORNBANK, BBVA, CommerzBank, Santander, Kaspi Bank, AlfaBank, Raiffeisen, mBank, Paribas, Bereke Bank, Freedom Bank   PAYMENT SYSTEMS ☟ Bunq on emulator (DE, NL, FR, ES, IE ibans), Revolut on emulator (UK/EU), ICard, BlackCatCard, Vivid DE, Bankera, Bitsa, Wise EU/UK, N26 DE on emulator, Skrill, Neteller, Trasta, Wirex, Lama, Paysera, 4x4 io, Weststein, Paysafecard, Paysend, Genome, Conotoxia, Mybrocard, Payz Silver, Pockit UK, NagaPay, Volet com, SpectroCoin, SwissMoney, Yuh, Lydia / Sumeria, Ka.App, Wittix, Western Union, MyGuava   CRYPTOEXCHANGE ☟ Poloniex, Bitmart, Kraken, WhiteBit, Quppy, Nexo, Gate, OKX, Paybis, Paxful, Huobi (HTX), xcoins com, Bit2Me, Bybit LVL 2, KuCoin, Binance LVL 2, Mexc, Latoken   Contact via telegram - in the first post of the topic!
    • Sell "Amoral" Classic Armor and Weapon.   Custom "Amoral" Draconic Set YouTube Custom "Amoral" Imperial Set YouTube Custom "Amoral" Dark Crystal Robe YouTube Custom "Amoral" Classic S-Grade Weapon YouTube My Contacts Telegram  
    • Greetings to all! I offer a scope for client modification. What services do I provide: 1) Transfer of any Weapon, Armor, Accessories, from any chronicles to yours. 2) Creating exclusive add-ons. 3) Repainting of Armor, Weapons аnd Accessories. 4) Packing the icons you need and other things. 5) Creating NPCs with and without effects. 6) Create Monsters and Raid bosses, with effects and sounds. 7) HTLM NPC design. Creating Buttons and other things for your project. And much more If you have any questions, write in  Telegram. You can find some of the works here  YouTube
  • Topics

×
×
  • Create New...