ZURSULUS L2

Grim Collector

ID
325
Название
Grim Collector
start_npcs_json
[30336]
npc_ids_json
[30336,30342,30434]
constants_json
{"CURTIS":30336,"VARSAK":30342,"SAMED":30434,"ANATOMY_DIAGRAM":1349,"ZOMBIE_HEAD":1350,"ZOMBIE_HEART":1351,"ZOMBIE_LIVER":1352,"SKULL":1353,"RIB_BONE":1354,"SPINE":1355,"ARM_BONE":1356,"THIGH_BONE":1357,"COMPLETE_SKELETON":1358}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00325_GrimCollector/Q00325_GrimCollector.java

NPC квеста

IDНазваниеСтарт квестаУровень
30336CurtisДа80
30342VarsakНет70
30434SamedНет70

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

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

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

giveItems(player, ANATOMY_DIAGRAM, 1);
giveAdena(player, 543 + (341 * skeletons), true);
giveItems(player, COMPLETE_SKELETON, 1);
giveItems(player, drop.getId(), 1);
giveAdena(player, reward, true);

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

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

[30336-01.htm] Guard Curtis: If you are thinking of going to the ruins, I can give you an errand that you will find rewarding. I can't tell you about it right now, but if you stop by later on I'll tell you in private. (This quest may only be undertaken by a character of level 15 and above.) [30336-02.htm] Guard Curtis: If you are thinking of going to the ruins, I can give you an errand that you will find rewarding. Just recently, I spoke with Samed, who lives near the edge of the village ... He asked me to refer a few skilled friends to him, when guards or mercenary soldier troops were dispatched near the ruins. I myself have helped him out a few times. The job is a little unpleasant, but ... the pay is good. What do you say, do you want to give it a try? Say you will take the job [30336-03.htm] Guard Curtis: Go to Samed to get all the details. If you meet him, tell him that Curtis sent you. Then he'll know I sent you and will give you the job. I wouldn't tell anyone you are working for Samed. So I hope you won't tell anyone that you received the job from me. Do you understand what I'm saying? [30336-04.htm] Guard Curtis: You haven't met Samed yet? Look now, I personally guarantee that this is a job that pays very well! Someone with your skills could earn big money. Of course, you'll have to work so that no one notices you ... So hurry up and find Samed. If you meet him, tell him that Curtis sent you. [30336-05.htm] Guard Curtis: I see you've talked with Samed. It is a bit unpleasant, but ... selling the bones and organs of those who are already dead should not cause any sort of real problem. And it doesn't hurt anyone, right? [30342-01.htm] Varsak: Our family has been doing this work for generations. However, there are hardly any people who look for undertakers these days. It is because the priests of Einhasad encourage cremation. However, sometimes, there are a few who come to follow the old customs. Have you come to me for a funeral? Is there anything I can do for you? Ask to assemble a skeleton [30342-02.htm] Varsak: I'm sorry, but that is impossible. To recompose a skeleton to human form, you must have all five parts: the skull, rib, spine, arm bone and thigh bone. By the way, you don't work for Samed, do you? It would be better to stay away from him. Bad rumors always follow him -- that he is a student of the evil Wizard Hardin or a servant of the devil Beleth. That is why people avoid him. [30342-03.htm] Varsak: I am not sure the bone pieces are from the same person, but ... At any rate, I'll try to recompose the skeleton. This is the least we can do to put the angry spirit of a person who died at war to rest. Please give him or her a proper funeral. But ... You don't work for Samed, do you? It would be better to keep your distance from him. Bad rumors always follow him -- they say he is a student of the black magician Hardin or a servant of the devil Beleth. People avoid him for a reason. [30342-04.htm] Varsak: Ah! Oh dear ... Forgive me! The bone was too old ... It got smashed while I was trying to recompose the skeleton. [30434-01.htm] Samed: What could a humble person like me have to ask you? It would be nice if you just left me alone so I could live quietly... Say that Curtis sent you [30434-02.htm] Samed: Hmm? So you came to me for a job. Well, are you thinking of going to the ruins? If you find me a few things from there, I will generously reward you afterwards. Though I am not sure whether you will come back alive from that place that crawls with zombies and skeletons. You must find me corpse pieces. Of course there are many corpses in the graveyard, but if you are caught disturbing the graves and pulling out coffins, you will be considered a witch and be burnt at the stake. So there is no choice but to take the living corpses from the undead. Why do I need corpse pieces? Don't try to know the reason. Haven't you heard that curiosity killed the cat? All you have to do is find what I need and take the money. Ask about the corpse pieces [30434-03.htm] Samed: Collect corpse pieces from the Ruins of Despair or the Ruins of Agony. If you don't know how to find the ruins, ask Guard Curtis or Guard Babenco. From the zombies, bring their head, heart, and liver. From the skeletons, bring the skull, spine, rib, arm bone, and thigh bone. I also need bone pieces, but actually I need a Complete Skeleton of Human form more. Unfortunately, when you fight with the undead, their body shatters so it will be impossible to find a Complete Skeleton. But the person that took this job before you found one somehow. Ah, and don't bring back anything from the spartoi. Spartoi are his minions... It is better not to make him angry. [30434-04.htm] Samed: You have returned already? I see you have not found the items I asked you for. I am very disappointed... I will explain to you again, so listen carefully. Go to the Ruins of Despair or the Ruins of Agony and find me the corpse pieces of the undead and I will give you an ample reward. If you don't know how to find the ruins, ask Guard Curtis or Guard Babenco. Say you will quit. Say you will continue. [30434-05.htm] Samed: Did you come unseen by the guards? Do you have the items I asked you for? Give them to me before the smell of decay fills the village! Calculate items Say you will quit [30434-06.htm] Samed: You seem exhausted from dealing with the dead souls. Well, it may have been too difficult for someone like you, who has lived only in the bright world. But I keep my promises, don't I? I will compensate you for the number of items you have brought. I have put the money in this coin purse, so make sure you tuck it in your pocket. You must be swearing to yourself that you will never do such an unpleasant job again, right? I can tell just from your eyes. However, you may have to come to me in the end. You will realize in no time that there is no other job that pays as much. [30434-07.htm] Samed: Then I will pay you according to the number of corpse pieces you have brought. Keep up the good work. Ah! And let me give you one word of advice. You do not need to be frightened by the undead of the ruins. They move by the power of black magic, but they are really just decayed pieces of meat. If you think of it that way, there is no reason to be afraid, right? [30434-08.htm] Samed: Ohh! You brought back a Complete Skeleton! You haven't dug up some cemetery, have you? Well, hand it over to me before the villagers see! Calculate Complete Skeleton Calculate corpse pieces Say you will quit [30434-09.htm] Samed: As I promised, I will compensate you according to the number of remains. I have filled this pouch full of coins so keep it safe. Looking at your pocket, I see you have many small corpse pieces in addition to complete skeletons. Give them to me before the smell of decay fills the village! Calculate corpse pieces Say you will quit
Исходник условий и наград (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.Q00325_GrimCollector;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.entity.item.holders.ItemHolder;
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 Q00325_GrimCollector extends Quest
{
	// NPCs
	private static final int CURTIS = 30336;
	private static final int VARSAK = 30342;
	private static final int SAMED = 30434;
	
	// Items
	private static final int ANATOMY_DIAGRAM = 1349;
	private static final int ZOMBIE_HEAD = 1350;
	private static final int ZOMBIE_HEART = 1351;
	private static final int ZOMBIE_LIVER = 1352;
	private static final int SKULL = 1353;
	private static final int RIB_BONE = 1354;
	private static final int SPINE = 1355;
	private static final int ARM_BONE = 1356;
	private static final int THIGH_BONE = 1357;
	private static final int COMPLETE_SKELETON = 1358;
	
	// Drops
	private static final Map<Integer, List<ItemHolder>> DROPLIST = new HashMap<>();
	static
	{
		DROPLIST.put(20026, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 50), new ItemHolder(ZOMBIE_LIVER, 75)));
		DROPLIST.put(20029, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 52), new ItemHolder(ZOMBIE_LIVER, 75)));
		DROPLIST.put(20035, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 15), new ItemHolder(SPINE, 29), new ItemHolder(THIGH_BONE, 79)));
		DROPLIST.put(20042, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 19), new ItemHolder(ARM_BONE, 69), new ItemHolder(THIGH_BONE, 86)));
		DROPLIST.put(20045, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(SPINE, 59), new ItemHolder(ARM_BONE, 77), new ItemHolder(THIGH_BONE, 97)));
		DROPLIST.put(20051, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(RIB_BONE, 59), new ItemHolder(SPINE, 79), new ItemHolder(ARM_BONE, 100)));
		DROPLIST.put(20457, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 60), new ItemHolder(ZOMBIE_LIVER, 80)));
		DROPLIST.put(20458, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 70), new ItemHolder(ZOMBIE_LIVER, 100)));
		DROPLIST.put(20514, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 21), new ItemHolder(SPINE, 30), new ItemHolder(ARM_BONE, 31), new ItemHolder(THIGH_BONE, 64)));
		DROPLIST.put(20515, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 20), new ItemHolder(SPINE, 31), new ItemHolder(ARM_BONE, 33), new ItemHolder(THIGH_BONE, 69)));
	}
	
	public Q00325_GrimCollector()
	{
		super(325, "Grim Collector");
		registerQuestItems(ZOMBIE_HEAD, ZOMBIE_HEART, ZOMBIE_LIVER, SKULL, RIB_BONE, SPINE, ARM_BONE, THIGH_BONE, COMPLETE_SKELETON, ANATOMY_DIAGRAM);
		addStartNpc(CURTIS);
		addTalkId(CURTIS, VARSAK, SAMED);
		addKillId(DROPLIST.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 "30336-03.htm":
			{
				st.startQuest();
				break;
			}
			case "30434-03.htm":
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				giveItems(player, ANATOMY_DIAGRAM, 1);
				break;
			}
			case "30434-06.htm":
			{
				takeItems(player, ANATOMY_DIAGRAM, -1);
				payback(player);
				st.exitQuest(true, true);
				break;
			}
			case "30434-07.htm":
			{
				payback(player);
				break;
			}
			case "30434-09.htm":
			{
				final int skeletons = getQuestItemsCount(player, COMPLETE_SKELETON);
				if (skeletons > 0)
				{
					playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
					takeItems(player, COMPLETE_SKELETON, -1);
					giveAdena(player, 543 + (341 * skeletons), true);
				}
				break;
			}
			case "30342-03.htm":
			{
				if (!hasQuestItems(player, SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE))
				{
					htmltext = "30342-02.htm";
				}
				else
				{
					takeItems(player, SPINE, 1);
					takeItems(player, SKULL, 1);
					takeItems(player, ARM_BONE, 1);
					takeItems(player, RIB_BONE, 1);
					takeItems(player, THIGH_BONE, 1);
					
					if (getRandom(10) < 9)
					{
						giveItems(player, COMPLETE_SKELETON, 1);
					}
					else
					{
						htmltext = "30342-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() < 15) ? "30336-01.htm" : "30336-02.htm";
				break;
			}
			case State.STARTED:
			{
				switch (npc.getId())
				{
					case CURTIS:
					{
						htmltext = (!hasQuestItems(player, ANATOMY_DIAGRAM)) ? "30336-04.htm" : "30336-05.htm";
						break;
					}
					case SAMED:
					{
						if (!hasQuestItems(player, ANATOMY_DIAGRAM))
						{
							htmltext = "30434-01.htm";
						}
						else
						{
							if (getNumberOfPieces(player) == 0)
							{
								htmltext = "30434-04.htm";
							}
							else
							{
								htmltext = !hasQuestItems(player, COMPLETE_SKELETON) ? "30434-05.htm" : "30434-08.htm";
							}
						}
						break;
					}
					case VARSAK:
					{
						htmltext = "30342-01.htm";
						break;
					}
				}
				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;
		}
		
		if (hasQuestItems(player, ANATOMY_DIAGRAM))
		{
			final int chance = getRandom(100);
			for (ItemHolder drop : DROPLIST.get(npc.getId()))
			{
				if (chance < drop.getCount())
				{
					giveItems(player, drop.getId(), 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					break;
				}
			}
		}
	}
	
	private static int getNumberOfPieces(Player player)
	{
		return getQuestItemsCount(player, ZOMBIE_HEAD) + getQuestItemsCount(player, SPINE) + getQuestItemsCount(player, ARM_BONE) + getQuestItemsCount(player, ZOMBIE_HEART) + getQuestItemsCount(player, ZOMBIE_LIVER) + getQuestItemsCount(player, SKULL) + getQuestItemsCount(player, RIB_BONE) + getQuestItemsCount(player, THIGH_BONE) + getQuestItemsCount(player, COMPLETE_SKELETON);
	}
	
	private void payback(Player player)
	{
		final int count = getNumberOfPieces(player);
		if (count > 0)
		{
			int reward = (30 * getQuestItemsCount(player, ZOMBIE_HEAD)) + (20 * getQuestItemsCount(player, ZOMBIE_HEART)) + (20 * getQuestItemsCount(player, ZOMBIE_LIVER)) + (100 * getQuestItemsCount(player, SKULL)) + (40 * getQuestItemsCount(player, RIB_BONE)) + (14 * getQuestItemsCount(player, SPINE)) + (14 * getQuestItemsCount(player, ARM_BONE)) + (14 * getQuestItemsCount(player, THIGH_BONE)) + (341 * getQuestItemsCount(player, COMPLETE_SKELETON));
			if (count > 10)
			{
				reward += 1629;
			}
			
			if (hasQuestItems(player, COMPLETE_SKELETON))
			{
				reward += 543;
			}
			
			takeItems(player, ZOMBIE_HEAD, -1);
			takeItems(player, ZOMBIE_HEART, -1);
			takeItems(player, ZOMBIE_LIVER, -1);
			takeItems(player, SKULL, -1);
			takeItems(player, RIB_BONE, -1);
			takeItems(player, SPINE, -1);
			takeItems(player, ARM_BONE, -1);
			takeItems(player, THIGH_BONE, -1);
			takeItems(player, COMPLETE_SKELETON, -1);
			
			giveAdena(player, reward, true);
		}
	}
}