ZURSULUS L2

In the Forgotten Village

ID
633
Название
In the Forgotten Village
start_npcs_json
[31388]
npc_ids_json
[31388]
constants_json
{"MINA":31388,"RIB_BONE":7544,"ZOMBIE_LIVER":7545}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00633_InTheForgottenVillage/Q00633_InTheForgottenVillage.java

NPC квеста

IDНазваниеСтарт квестаУровень
31388MinaДа70

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

htmltext = (player.getLevel() < 65) ? "31388-03.htm" : "31388-01.htm";

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

giveAdena(player, 25000, true);
addExpAndSp(player, 305235, 0);
giveItems(partyMember, ZOMBIE_LIVER, 1);
giveItems(partyMember, RIB_BONE, 1);

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

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

[31388-01.htm] Mina: Surely you've seen the undead lurking about the village? They've been around as long as anyone around here can remember! Recently, we've been plagued by dark magi, and as you can imagine, it's been very chaotic! Things are so topsy-turvy, I doubt that the trees will even bear fruit this season! We need a strong, helping hand! Would you help our village? "I'll help you." [31388-03.htm] Mina: Thank you, but I seriously doubt that you could defeat the dark magi! We've been used to dealing with monsters, but these dark bastards are something else! They would kill you! Why don't you come back when you're older. (This quest may only be undertaken by a character of level 65 and above.) [31388-04.htm] Mina: Thanks for helping us! Basically, we need two things done. First and most important, wipe out the dark magi! They are our biggest threat! Defeat them and you'll be well-rewarded! Please slay at least 200 of them! Also, I would ask that you please exterminate the undead that are wandering around here during the day. We've been plagued by those filthy wretches for far too long! When you destroy them, you'll find their rotting livers remain. I'll reward you for each one you bring to me! Bring as many as you want, any time that you want! But remember, I ask that you kill at least 200 black magi before you return to me. Got it? [31388-05.htm] Mina: Oh, you're back! Have you brought proof of killing 200 black magi? That's great! As I promised, you'll be well rewarded! But, as you probably know, our village is small and we don't have much money... It's actually the responsibility of our lord to give out rewards for hunting the undead... Settle up for black magi rib bones. Settle up for undead livers. "I quit." [31388-06.htm] Mina: How can I help you, hmm? Have you brought proof of killing 200 black magi? No? Any nasty undead livers? You'll be paid for those, but not much! Settle up for the undead livers. Keep hunting. Stop hunting. [31388-07.htm] Mina: Please, hunt black magi and bring back 200 proofs of their deaths! And don't forget the undead livers, our lord is paying for those, as well! Now, take your leave! Good luck! [31388-08.htm] Mina: Here is your reward! I know it's not much, but it's all we can afford! Let me know if you want to hunt any more black magi! And don't forget, we love those undead livers! Our lord's rewards are ample, don't you think? Settle up accounts for undead livers. "I'll hunt black magi." "I quit." [31388-09.htm] Mina: Oh, did you kill 200 black magi? Hmm, that's strange! There aren't enough proofs here!? Do you think you might have dropped some of them on your way here? [31388-10.htm] Mina: You want to quit? Well, I won't stop you! Thank you for what you've done! Have a great trip! All you'll see is corpses, though... Ha!
Исходник условий и наград (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.Q00633_InTheForgottenVillage;

import java.util.HashMap;
import java.util.Map;

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 Q00633_InTheForgottenVillage extends Quest
{
	// NPCs
	private static final int MINA = 31388;
	
	// Items
	private static final int RIB_BONE = 7544;
	private static final int ZOMBIE_LIVER = 7545;
	
	// Monsters / Drop chances
	private static final Map<Integer, Integer> MOBS = new HashMap<>();
	static
	{
		MOBS.put(21557, 328000); // Bone Snatcher
		MOBS.put(21558, 328000); // Bone Snatcher
		MOBS.put(21559, 337000); // Bone Maker
		MOBS.put(21560, 337000); // Bone Shaper
		MOBS.put(21563, 342000); // Bone Collector
		MOBS.put(21564, 348000); // Skull Collector
		MOBS.put(21565, 351000); // Bone Animator
		MOBS.put(21566, 359000); // Skull Animator
		MOBS.put(21567, 359000); // Bone Slayer
		MOBS.put(21572, 365000); // Bone Sweeper
		MOBS.put(21574, 383000); // Bone Grinder
		MOBS.put(21575, 383000); // Bone Grinder
		MOBS.put(21580, 385000); // Bone Caster
		MOBS.put(21581, 395000); // Bone Puppeteer
		MOBS.put(21583, 397000); // Bone Scavenger
		MOBS.put(21584, 401000); // Bone Scavenger
	}
	private static final Map<Integer, Integer> UNDEADS = new HashMap<>();
	static
	{
		UNDEADS.put(21553, 347000); // Trampled Man
		UNDEADS.put(21554, 347000); // Trampled Man
		UNDEADS.put(21561, 450000); // Sacrificed Man
		UNDEADS.put(21578, 501000); // Behemoth Zombie
		UNDEADS.put(21596, 359000); // Requiem Lord
		UNDEADS.put(21597, 370000); // Requiem Behemoth
		UNDEADS.put(21598, 441000); // Requiem Behemoth
		UNDEADS.put(21599, 395000); // Requiem Priest
		UNDEADS.put(21600, 408000); // Requiem Behemoth
		UNDEADS.put(21601, 411000); // Requiem Behemoth
	}
	
	public Q00633_InTheForgottenVillage()
	{
		super(633, "In the Forgotten Village");
		registerQuestItems(RIB_BONE, ZOMBIE_LIVER);
		addStartNpc(MINA);
		addTalkId(MINA);
		addKillId(MOBS.keySet());
		addKillId(UNDEADS.keySet());
	}
	
	@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 "31388-04.htm":
			{
				st.startQuest();
				break;
			}
			case "31388-10.htm":
			{
				takeItems(player, RIB_BONE, -1);
				st.exitQuest(true, true);
				break;
			}
			case "31388-09.htm":
			{
				if (getQuestItemsCount(player, RIB_BONE) >= 200)
				{
					htmltext = "31388-08.htm";
					takeItems(player, RIB_BONE, 200);
					giveAdena(player, 25000, true);
					addExpAndSp(player, 305235, 0);
				}
				
				st.setCond(1, true);
				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() < 65) ? "31388-03.htm" : "31388-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				if (cond == 1)
				{
					htmltext = "31388-06.htm";
				}
				else if (cond == 2)
				{
					htmltext = "31388-05.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final int npcId = npc.getId();
		final Integer undeadChance = UNDEADS.get(npcId);
		if (undeadChance != null)
		{
			final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
			if ((st == null) || !st.isStarted())
			{
				return;
			}
			
			if (getRandom(1000000) < undeadChance)
			{
				final Player partyMember = st.getPlayer();
				giveItems(partyMember, ZOMBIE_LIVER, 1);
				playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
		}
		else if (MOBS.containsKey(npcId))
		{
			final Player partyMember = getRandomPartyMember(player, 1);
			if (partyMember == null)
			{
				return;
			}
			
			final QuestState st = getQuestState(partyMember, false);
			if (getRandom(1000000) < MOBS.get(npcId))
			{
				giveItems(partyMember, RIB_BONE, 1);
				if (getQuestItemsCount(partyMember, RIB_BONE) < 200)
				{
					playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				else
				{
					st.setCond(2, true);
				}
			}
		}
	}
}