ZURSULUS L2

Defeat the Elrokian Raiders!

ID
688
Название
Defeat the Elrokian Raiders!
start_npcs_json
[32105]
npc_ids_json
[22214,32105]
constants_json
{"DINN":32105,"ELROKI":22214,"DINOSAUR_FANG_NECKLACE":8785}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00688_DefeatTheElrokianRaiders/Q00688_DefeatTheElrokianRaiders.java

NPC квеста

IDНазваниеСтарт квестаУровень
22214ElrokiНет85
32105DinnДа70

Условия уровней: выражения из Java

htmltext = (player.getLevel() < 75) ? "32105-00.htm" : "32105-01.htm";

Выдача предметов, адены и опыта: выражения из Java

giveAdena(player, count * 3000, true);
giveAdena(player, count * 3000, true);
giveAdena(player, 450000, true);
giveItems(partyMember, DINOSAUR_FANG_NECKLACE, 1);

Квесты содержат динамические условия Java. Выражения выдачи включают промежуточные предметы, варианты и случайные награды; это не гарантированная награда. Константы приведены выше. Полные условия — в исходнике.

Тексты квеста

[32105-00.htm] Dinn: You're not someone who is skilled enough and brave enough to handle my tasks. (This quest may only be undertaken by a character of level 75 and above.) [32105-01.htm] Dinn: Hey, you there -- Sir Adventurer! May I speak to you for a moment? Have you heard of the Elrokian brigands hiding in the Primeval Plains? The wharf merchants and I are beset by them. Sales haven't been good, and since those thieves don't look like they'll go away any time soon on their own, it's been as bad a time around here as I can remember. "Find out more details." [32105-02.htm] Dinn: At first, they stole only small items. But success has made them bold, and lately they have organized themselves into armed groups that raid even in broad daylight. The merchants on the wharf are understandably on edge. Despite standing constant watch over their wares, they have not the skill or weaponry to defend themselves against such formidable adversaries. But you, my fine young adventurer, you look like you might have a chance. Please, please help us. Eliminate these Elrokian brigands and we will reward you as richly as we can! "Pledge your services to catch the thieves." [32105-03.htm] Dinn: Gods be praised! Now that I know that you are willing to help us, I finally feel like I'll be able to sleep soundly tonight. According to a trustworthy source, the Elrokian thieves who raid our wharf all wear necklaces that contain a dinosaur fang pendant. Bring me those necklaces as proof that you have captured them; I'll reward you based on the number of necklaces you bring. If you bring back more than 100 necklaces, I can also give you the donations collected from the merchants here. Please, whatever it takes, rid us of these troublesome thieves! As long as you bring me their necklaces, I'll make sure that you are well compensated for your time. The Elrokian raiders have set up camp in the Primeval Plains. Travel south along this road, and I'm certain that you'll find them. [32105-04.htm] Dinn: You don't have enough items yet. Please, whatever it takes, rid us of these troublesome thieves! As long as you bring me their necklaces, I'll make sure that you are well compensated for your time. The Elrokian raiders have set up camp in the Primeval Plains. Travel south along this road, and I'm certain that you'll find them. [32105-05.htm] Dinn: Eh? You caught them? Ah, it finally feels like a weight has been lifted! First of all let me offer you a reward equal to the number of necklaces you've brought. If you have more than 100 necklaces, I can also give you a bounty collected by our local merchants. Truth be told, I was prepared to offer the reward money myself, but when our merchants caught wind of your efforts, they insisted on contributing funds to the cause themselves. A noble act on their part, I dare say! It is entirely your choice whether to collect the per necklace bounty or accept the merchant's donation. "Take the per necklace bounty." "Take the merchants' donation." [32105-06.htm] Dinn: Here, please take this reward. It's miniscule compared to all you've done for us, but this is the best we can do, and please know it comes from the bottom of our hearts. Word has reached me that there are still many Elrokian raiders in the Primeval Plains, and their numbers are increasing. What do you think? Now that you've gained some experience, would you like to keep catching the thieves? "Continue to capture the Elrokian raiders." "Quit." [32105-07.htm] Dinn: You have done a fantastic job! I know how difficult it must have been to collect 100 necklaces, and here you are donating them with no strings attached. I can't tell you how grateful we are! Here, please take this reward. It's miniscule compared to all you've done for us, but this is the best we can do, and please know it comes from the bottom of our hearts. Word has reached me that there are still many Elrokian raiders in the Primeval Plains, and their numbers are increasing. What do you think? Now that you've gained some experience, would you like to keep catching the thieves? "Continue to capture the Elrokian raiders." "Collect the balance of your reward and quit." [32105-08.htm] Dinn: Very well, then. I am saddened that you have chosen not to continue. If you change your mind, please don't hesitate to return!
Исходник условий и наград (Java)
/*
 * Copyright (c) 2013 L2jMobius
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package quests.Q00688_DefeatTheElrokianRaiders;

import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.mechanics.script.Quest;
import org.l2jmobius.gameserver.mechanics.script.QuestSound;
import org.l2jmobius.gameserver.mechanics.script.QuestState;
import org.l2jmobius.gameserver.mechanics.script.State;

public class Q00688_DefeatTheElrokianRaiders extends Quest
{
	// NPC
	private static final int DINN = 32105;
	
	// Monster
	private static final int ELROKI = 22214;
	
	// Item
	private static final int DINOSAUR_FANG_NECKLACE = 8785;
	
	public Q00688_DefeatTheElrokianRaiders()
	{
		super(688, "Defeat the Elrokian Raiders!");
		registerQuestItems(DINOSAUR_FANG_NECKLACE);
		addStartNpc(DINN);
		addTalkId(DINN);
		addKillId(ELROKI);
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		switch (event)
		{
			case "32105-03.htm":
			{
				st.startQuest();
				break;
			}
			case "32105-08.htm":
			{
				final int count = getQuestItemsCount(player, DINOSAUR_FANG_NECKLACE);
				if (count > 0)
				{
					takeItems(player, DINOSAUR_FANG_NECKLACE, -1);
					giveAdena(player, count * 3000, true);
				}
				
				st.exitQuest(true, true);
				break;
			}
			case "32105-06.htm":
			{
				final int count = getQuestItemsCount(player, DINOSAUR_FANG_NECKLACE);
				takeItems(player, DINOSAUR_FANG_NECKLACE, -1);
				giveAdena(player, count * 3000, true);
				break;
			}
			case "32105-07.htm":
			{
				final int count = getQuestItemsCount(player, DINOSAUR_FANG_NECKLACE);
				if (count >= 100)
				{
					takeItems(player, DINOSAUR_FANG_NECKLACE, 100);
					giveAdena(player, 450000, true);
				}
				else
				{
					htmltext = "32105-04.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		String htmltext = getNoQuestMsg(player);
		final QuestState st = getQuestState(player, true);
		
		switch (st.getState())
		{
			case State.CREATED:
			{
				htmltext = (player.getLevel() < 75) ? "32105-00.htm" : "32105-01.htm";
				break;
			}
			case State.STARTED:
			{
				htmltext = (!hasQuestItems(player, DINOSAUR_FANG_NECKLACE)) ? "32105-04.htm" : "32105-05.htm";
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
		if ((st == null) || !st.isStarted())
		{
			return;
		}
		
		if (getRandomBoolean())
		{
			final Player partyMember = st.getPlayer();
			giveItems(partyMember, DINOSAUR_FANG_NECKLACE, 1);
			playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
		}
	}
}