ZURSULUS L2

The Guard is Busy

ID
257
Название
The Guard is Busy
start_npcs_json
[30039]
npc_ids_json
[]
constants_json
{"GLUDIO_LORD_MARK":1084,"ORC_AMULET":752,"ORC_NECKLACE":1085,"WEREWOLF_FANG":1086,"SPIRITSHOT_FOR_BEGINNERS":5790,"SOULSHOT_FOR_BEGINNERS":5789}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java

NPC квеста

Записей нет.

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

htmltext = (player.getLevel() < 6) ? "30039-01.htm" : "30039-02.htm";

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

giveItems(player, GLUDIO_LORD_MARK, 1);
giveAdena(player, reward, true);
giveItems(player, SPIRITSHOT_FOR_BEGINNERS, 3000);
giveItems(player, SOULSHOT_FOR_BEGINNERS, 6000);
giveItems(player, ORC_AMULET, 1);
giveItems(player, ORC_NECKLACE, 1);
giveItems(player, WEREWOLF_FANG, 1);
giveItems(player, WEREWOLF_FANG, 1);
giveItems(player, WEREWOLF_FANG, 1);

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

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

[30039-01.htm] Captain Gilbert: A few weeks ago, the lord announced that he will transfer all of the refugees from the Gracian wars to Talking Island. But, as you know, Talking Island still has many regions where it is too dangerous for people to live. The southern village of the island and regions surrounding the magic school are safe, but the inland woods and northern shores are places that even we guards do not like to venture into, not only because of the vicious wild beasts, but also because of the Orc masses and violent werewolves that live there. Before going ahead with his plans to relocate the refugees, the lord has officially issued a command to eliminate from Talking Island the dangerous beasts that pose a threat to the lives of residents. They say that the lord's command will be officially announced in a few days. How do you feel about participating in the beast hunt? (This quest may only be undertaken by a character of level 6 and above.) [30039-02.htm] Captain Gilbert: A few weeks ago, the lord announced that he will transfer all of the refugees from the Gracian wars to Talking Island. But, as you know, Talking Island still has many regions where it is too dangerous for people to live. The southern village of the island and regions surrounding the magic school are safe, but the inland woods and northern shores are places that even we guards do not like to venture into, not only because of the vicious wild beasts, but also because of the Orc masses and violent werewolves that live there. Before going ahead with his plans to relocate the war refugees, the lord has officially issued a command to eliminate from Talking Island the dangerous beasts that pose a threat to the lives of residents. Whoever slays the orcs or werewolves, and brings back proof, will be given a reward. Already many of the young men have armed themselves and gone out from of the village. How about if you participate in the hunt? You can gain some actual battle experience, and it's also a good opportunity to receive prizes given in the name of our lord. Say you will participate in the hunt [30039-03.htm] Captain Gilbert: Go and slay orcs and werewolves that live on Talking Island, and bring back proof of their deaths. Prizes will be awarded according to the amount of proof that you bring back. Bring back the feather Orc Amulet, Werewolf Fangs, or the Orc's Necklace that orcs of fighter rank carry. This task is not just a simple hunt, but an official announcement that, under the will of the lord, Talking Island is now part of the Aden Kingdom. Therefore, the aggressors who have invaded our land must be punished accordingly. All who participate in this hunt are representatives carrying out the will of the lord, and must carry this symbol of the lord at all times. May the blessings of Einhasad be with you. [30039-04.htm] Captain Gilbert: You cannot hope for any reward if you laze around in the village. Go outside the village immediately and join in on the hunt. This will be our chance to drive the orcs and werewolves from our lands and make Talking Island a suitable place for Humans to live in. Don't tell me you've come back because you want to give up? Do you always give up that easily? Say you will go on the hunt Say you will quit [30039-05.htm] Captain Gilbert: You have done well. May the blessings of Einhasad be with you. [30039-06.htm] Captain Gilbert: Please continue, then. Pretty soon, our Talking Island will be a suitable place for peaceful citizens to live in, free of violent orcs and vicious werewolves. [30039-07.htm] Captain Gilbert: Well done. I will reward you for every piece of proof you have brought me. This is a reward given to honor the fighters who have faithfully carried out the will of our lord. The lord's decree is still valid. There is still more adena left for rewards. Will you continue your hunt, or will you quit? Say you will quit Say you will continue
Исходник условий и наград (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.Q00257_TheGuardIsBusy;

import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.config.GeneralConfig;
import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.entity.actor.enums.creature.Race;
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;
import org.l2jmobius.gameserver.mechanics.variables.PlayerVariables;

public class Q00257_TheGuardIsBusy extends Quest
{
	// Items
	private static final int GLUDIO_LORD_MARK = 1084;
	private static final int ORC_AMULET = 752;
	private static final int ORC_NECKLACE = 1085;
	private static final int WEREWOLF_FANG = 1086;
	
	// Newbie Items
	private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
	private static final int SOULSHOT_FOR_BEGINNERS = 5789;
	
	public Q00257_TheGuardIsBusy()
	{
		super(257, "The Guard is Busy");
		registerQuestItems(ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG, GLUDIO_LORD_MARK);
		addStartNpc(30039); // Gilbert
		addTalkId(30039);
		addKillId(20006, 20093, 20096, 20098, 20130, 20131, 20132, 20342, 20343);
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		final String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		if (event.equals("30039-03.htm"))
		{
			st.startQuest();
			giveItems(player, GLUDIO_LORD_MARK, 1);
		}
		else if (event.equals("30039-05.htm"))
		{
			takeItems(player, GLUDIO_LORD_MARK, 1);
			st.exitQuest(true, true);
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		final QuestState st = getQuestState(player, true);
		String htmltext = getNoQuestMsg(player);
		
		switch (st.getState())
		{
			case State.CREATED:
			{
				htmltext = (player.getLevel() < 6) ? "30039-01.htm" : "30039-02.htm";
				break;
			}
			case State.STARTED:
			{
				final int amulets = getQuestItemsCount(player, ORC_AMULET);
				final int necklaces = getQuestItemsCount(player, ORC_NECKLACE);
				final int fangs = getQuestItemsCount(player, WEREWOLF_FANG);
				
				if ((amulets + necklaces + fangs) == 0)
				{
					htmltext = "30039-04.htm";
				}
				else
				{
					htmltext = "30039-07.htm";
					
					int reward = (10 * amulets) + (20 * fangs) + (20 * necklaces);
					if (!GeneralConfig.ALT_VILLAGES_REPEATABLE_QUEST_REWARD && ((amulets + necklaces + fangs) >= 10))
					{
						reward += 1000;
					}
					
					takeItems(player, ORC_AMULET, -1);
					takeItems(player, ORC_NECKLACE, -1);
					takeItems(player, WEREWOLF_FANG, -1);
					giveAdena(player, reward, true);
					
					// Give newbie reward if player is eligible.
					if (player.isNewbie() && (st.getInt("Reward") == 0))
					{
						int newPlayerRewardsReceived = player.getVariables().getInt(PlayerVariables.NEWBIE_SHOTS_RECEIVED, 0);
						if (newPlayerRewardsReceived < 1)
						{
							st.showQuestionMark(26);
							st.set("Reward", "1");
							
							if (player.isMageClass() && (player.getRace() != Race.ORC))
							{
								st.playTutorialVoice("tutorial_voice_027");
								giveItems(player, SPIRITSHOT_FOR_BEGINNERS, 3000);
								player.getVariables().set(PlayerVariables.NEWBIE_SHOTS_RECEIVED, ++newPlayerRewardsReceived);
							}
							else
							{
								st.playTutorialVoice("tutorial_voice_026");
								giveItems(player, SOULSHOT_FOR_BEGINNERS, 6000);
								player.getVariables().set(PlayerVariables.NEWBIE_SHOTS_RECEIVED, ++newPlayerRewardsReceived);
							}
						}
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getQuestState(player, false);
		if ((st == null) || !st.isStarted())
		{
			return;
		}
		
		switch (npc.getId())
		{
			case 20006:
			case 20130:
			case 20131:
			{
				if (Rnd.get(10) < 5)
				{
					giveItems(player, ORC_AMULET, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
			case 20093:
			case 20096:
			case 20098:
			{
				if (Rnd.get(10) < 5)
				{
					giveItems(player, ORC_NECKLACE, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
			case 20342:
			{
				if (Rnd.get(10) < 2)
				{
					giveItems(player, WEREWOLF_FANG, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
			case 20343:
			{
				if (Rnd.get(10) < 4)
				{
					giveItems(player, WEREWOLF_FANG, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
			case 20132:
			{
				if (Rnd.get(10) < 5)
				{
					giveItems(player, WEREWOLF_FANG, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
		}
	}
}