ZURSULUS L2

Conquest of Alligator Island

ID
354
Название
Conquest of Alligator Island
start_npcs_json
[30895]
npc_ids_json
[]
constants_json
{"ALLIGATOR_TOOTH":5863,"TORN_MAP_FRAGMENT":5864,"PIRATE_TREASURE_MAP":5915}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00354_ConquestOfAlligatorIsland/Q00354_ConquestOfAlligatorIsland.java

NPC квеста

Записей нет.

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

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

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

giveAdena(player, reward, true);
giveItems(player, PIRATE_TREASURE_MAP, 1);

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

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

[30895-00.htm] Warehouse Freightman Kluck: I'm going crazy here! So many things to do... And nothing seems to be going right... What is the guild thinking, giving me such an assignment? What could they possibly expect me to do? Sometimes I wonder why I stay in this stupid guild! How long have you been standing there? I was just talking to myself. You're an adventurer, am I right? I don't have any work to give you right now. Come back later. (This quest may only be undertaken by a character of level 38 and above.) [30895-01.htm] Warehouse Freightman Kluck: Whew! There's no way I can keep up this pace! Hello, friend! Am I glad to see you! For as long as anyone can remember, Dwarves have been traders, am I right? And now come the Humans, with their friends in high places, taking over the trade routes in Innadril, Abella, and Giran! Who do they think they are? Boycott the Humans! We're establishing a free trade zone near Alligator Island! The only problem is, that place is crawling with horrible monsters. Would you help us get rid of them? If you'd like, we can draw up a Contract right now! "I will help you." [30895-02.htm] Warehouse Freightman Kluck: Well, then, here you go! Sign on the dotted line... Now, I'll read the Contract to you. Adventurer agrees to go to Alligator Island and kill the crokian lads, dailaon lads, crokian lad warriors, farhite lads, nos lads, and the Swamp Tribe and bring back their teeth as proof. And Kluck, that's me, will count the number of teeth brought back and reward said adventurer accordingly. Third, if said adventurer brings back 100 or more teeth at a time, he or she will receive an additional bonus. Fourth, while carrying out the task specified in the Contract on Alligator Island, if the adventurer finds items other than the teeth of monsters, the adventurer will own those items free and clear. Do these terms meet with your approval? Then, the Contract is formally established between us! Alligator Island is to the north, across the sea from here. This work will be hard for you to carry out by yourself. You'd better find other adventurers to go with you. If you wish, I will establish a Contract with them as well. Sorry, there's no bridge... You look rather strapping... Couldn't you swim there? [30895-03.htm] Warehouse Freightman Kluck: Good to see you again, my friend... Have you brought teeth? Or perhaps you have a question...? "Tell me more about the Contract i signed." "Here are the teeth." "I have a work to do." "I want out of the Contract." [30895-03a.htm] Warehouse Freightman Kluck: Ah, you again... Have you brought me teeth? Or is it another question? What's that, a piece of paper? "I have a question about the Contract." "I've brought you teeth." "I've got work to do." "I want out of the Contract." "Yes, it seems to be a piece of a Map..." [30895-04.htm] Warehouse Freightman Kluck: OK, one more time... Adventurer agrees to go to Alligator Island and kill the crokian lads, dailaon lads, crokian lad warriors, farhite lads, nos lads, and the Swamp Tribe and bring back their teeth as proof. And Kluck, that's me, will count the number of teeth brought back and reward said adventurer accordingly. Third, if said adventurer brings back 100 or more teeth at a time, he or she will receive an additional bonus. Fourth, while carrying out the task specified in the Contract on Alligator Island, if the adventurer finds items other than the teeth of monsters, the adventurer will own those items free and clear. Alligator Island is to the north, across the sea from here. Swim there! You look like you could use the exercise! Back [30895-05.htm] Warehouse Freightman Kluck: Are you kidding? You expect something for nothing? Not around here, my friend! Go to Alligator Island immediately and bring me back some teeth! Do I need to read the Contract to you again? [30895-05a.htm] Warehouse Freightman Kluck: Let's see, teeth are worth... Here you go! Thank you for your hard work! Hopefully soon the island will be completely free of monsters and our dream of a free trade zone without tax can be realized! Keep up the good work! "I'll get back to work now." "I want out of the Contract." [30895-05b.htm] Warehouse Freightman Kluck: Hey, impressive! You've brought over 100! Here is your reward! And, per the Contract, your bonus as well! I appreciate your hard work! Hopefully soon our dream of a free trade zone without tax will be realized. Keep up the good work! "I'll be getting back to work now." "I want out of the Contract." [30895-06.htm] Warehouse Freightman Kluck: That's a good adventurer... Heh heh... This free trade zone will benefit us all! [30895-07.htm] Warehouse Freightman Kluck: Hmm... A piece of Map, eh? I bet if we collected about 10 pieces just like it, we'd have a complete Map! Come to think of it, there is a rumor that part of the legendary treasure of Zaken the pirate is buried on Alligator Island. Zaken's boatswain's lover stole it and hid it there... [30895-08.htm] Warehouse Freightman Kluck: Ah, yes, these pieces definitely go together... Just like doing a puzzle! What have we here? This mark must show where the treasure is hidden! This must surely be the Map to the legendary treasure of Zaken the pirate! Hmm, I suppose, according to the terms of the Contract, that the Map rightfully belongs to you. Go and see Trader Espen in the weapons shop. He is an expert on Zaken. All pirates, actually... [30895-09.htm] Warehouse Freightman Kluck: What a pity... You won't be easy to replace... I appreciate your contribution to our cause... When the free trade zone on Alligator Island becomes a reality and I have opened my own shop, you must visit me there. May the prosperity of Maphr be with you always...
Исходник условий и наград (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.Q00354_ConquestOfAlligatorIsland;

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 Q00354_ConquestOfAlligatorIsland extends Quest
{
	// Items
	private static final int ALLIGATOR_TOOTH = 5863;
	private static final int TORN_MAP_FRAGMENT = 5864;
	private static final int PIRATE_TREASURE_MAP = 5915;
	
	// Drops
	private static final Map<Integer, Double> MOB1 = new HashMap<>();
	private static final Map<Integer, Integer> MOB2 = new HashMap<>();
	static
	{
		MOB1.put(20804, 0.84); // crokian_lad
		MOB1.put(20805, 0.91); // dailaon_lad
		MOB1.put(20806, 0.88); // crokian_lad_warrior
		MOB1.put(20807, 0.92); // farhite_lad
		MOB2.put(20808, 14); // nos_lad
		MOB2.put(20991, 69); // tribe_of_swamp
	}
	
	public Q00354_ConquestOfAlligatorIsland()
	{
		super(354, "Conquest of Alligator Island");
		registerQuestItems(ALLIGATOR_TOOTH, TORN_MAP_FRAGMENT);
		addStartNpc(30895); // Kluck
		addTalkId(30895);
		addKillId(MOB1.keySet());
		addKillId(MOB2.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 "30895-02.htm":
			{
				st.startQuest();
				break;
			}
			case "30895-03.htm":
			{
				if (hasQuestItems(player, TORN_MAP_FRAGMENT))
				{
					htmltext = "30895-03a.htm";
				}
				break;
			}
			case "30895-05.htm":
			{
				final int amount = getQuestItemsCount(player, ALLIGATOR_TOOTH);
				if (amount > 0)
				{
					int reward = (amount * 220) + 3100;
					if (amount >= 100)
					{
						reward += 7600;
						htmltext = "30895-05b.htm";
					}
					else
					{
						htmltext = "30895-05a.htm";
					}
					
					takeItems(player, ALLIGATOR_TOOTH, -1);
					giveAdena(player, reward, true);
				}
				break;
			}
			case "30895-07.htm":
			{
				if (getQuestItemsCount(player, TORN_MAP_FRAGMENT) >= 10)
				{
					htmltext = "30895-08.htm";
					takeItems(player, TORN_MAP_FRAGMENT, 10);
					giveItems(player, PIRATE_TREASURE_MAP, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				break;
			}
			case "30895-09.htm":
			{
				st.exitQuest(true, 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() < 38) ? "30895-00.htm" : "30895-01.htm";
				break;
			}
			case State.STARTED:
			{
				htmltext = (hasQuestItems(player, TORN_MAP_FRAGMENT)) ? "30895-03a.htm" : "30895-03.htm";
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isSummon)
	{
		final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
		if (qs != null)
		{
			final int npcId = npc.getId();
			final Double mob1Chance = MOB1.get(npcId);
			if (mob1Chance != null)
			{
				giveItemRandomly(player, npc, ALLIGATOR_TOOTH, 1, 0, mob1Chance, true);
			}
			else
			{
				final int itemCount = ((getRandom(100) < MOB2.get(npcId)) ? 2 : 1);
				giveItemRandomly(player, npc, ALLIGATOR_TOOTH, itemCount, 0, 1, true);
			}
			
			giveItemRandomly(player, npc, TORN_MAP_FRAGMENT, 1, 0, 0.1, false);
		}
	}
}