ZURSULUS L2

Hunt of the Golden Ram Mercenary Force

ID
628
Название
Hunt of the Golden Ram Mercenary Force
start_npcs_json
[31554]
npc_ids_json
[31554]
constants_json
{"KAHMAN":31554,"SPLINTER_STAKATO_CHITIN":7248,"NEEDLE_STAKATO_CHITIN":7249,"GOLDEN_RAM_BADGE_RECRUIT":7246,"GOLDEN_RAM_BADGE_SOLDIER":7247}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java

NPC квеста

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

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

htmltext = (player.getLevel() < 66) ? "31554-01a.htm" : "31554-01.htm";

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

giveItems(player, GOLDEN_RAM_BADGE_RECRUIT, 1);
giveItems(player, GOLDEN_RAM_BADGE_SOLDIER, 1);
giveItems(partyMember, SPLINTER_STAKATO_CHITIN, 1);
giveItems(partyMember, NEEDLE_STAKATO_CHITIN, 1);

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

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

[31554-01.htm] Mercenary Kahman: I'm in charge of finding skilled soldiers to become brothers in our Golden Ram Mercenary Force! Are you up to the task? Quest [31554-01a.htm] Mercenary Kahman: I admire your courage, but you lack the required skills to join us. (This quest may only be undertaken by a character of level 66 and above.) [31554-02.htm] Mercenary Kahman: We are here to destroy the Stakatos in the Swamp of Screams. They're no match for our skills, but they're tough and outnumber us, so we need all the skilled help we can get. You meet the basic requirements, but you must prove yourself if you want to be a member of the Golden Ram Mercenary Force! Kill Splinter Stakatos, Splinter Stakato Walkers, Splinter Stakato Soldiers and Splinter Stakato Drones and bring back one-hundred Stakato Chitins to prove your worth. Good luck to you! [31554-03.htm] Mercenary Kahman: You're back! Have you taught the stakatos a lesson? "Here are the 100 Stakato Chitins." [31554-03a.htm] Mercenary Kahman: To become an honorable member of the Golden Ram Mercenary Force, you must collect 100 Chitins of Splinter Stakatos from the Swamp of Screams. Now go! [31554-04.htm] Mercenary Kahman: Great work, my soldier! You are fully qualified to become a brother of the Golden Ram Mercenary Force! Well, take this mark of Golden Ram - Recruit! From now on, you are a brother of the Golden Ram Mercenary Force. Congratulations! But, you must get stronger, stranger, if you want to become an elite soldier! Go into the Swamp of Screams, kill Splinter Stakatos and Needle Stakatos, and collect one-hundred Chitins each of Splinter Stakatos and Needle Stakatos! If you can't carry out such a task, you will not be able to become the Elite! [31554-04a.htm] Mercenary Kahman: There are two classes here, rookie and elite. An elite mercenary is a veteran with a long record of active service. The title earns you special privileges. Rookies must kill Needle Stakatos as well as Splinter Stakatos to gain elite status. Collect one-hundred Chitins each of Splinter Stakatos and Needle Stakatos to earn the title. Show them what you're worth! [31554-04b.htm] Mercenary Kahman: To become an elite member of the Golden Ram Mercenary Force, you must collect 100 Chitins each of Splinter Stakatos and Needle Stakatos. Prove your skills and you can raise in the ranks! "I'm ready to fight!" "I want to quit." [31554-05.htm] Mercenary Kahman: Your skills and long record of active service have earned you the title of elite mercenary in the Golden Ram Force! Take this mark of Golden Ram - Elite. Congratulations, brother! [31554-05a.htm] Mercenary Kahman: You're already an elite warrior! What more do you want? You are free to choose. "I want to return to the fight!" "I want to end our Contract." [31554-05b.htm] Mercenary Kahman: That's the spirit! Kill with extreme prejudice in the name of the Golden Ram! [31554-06.htm] Mercenary Kahman: It's not easy to become a member. If you quit now, you may regret it later! You'll have to start from the beginning if you come back. Are you sure? "I'm sure." [31554-07.htm] Mercenary Kahman: What a pity. We can't afford to lose such skills, but I'll respect your decision. I hope to hear of your great deeds someday. May Pa'agrio's Flame be with you!
Исходник условий и наград (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.Q00628_HuntGoldenRam;

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 Q00628_HuntGoldenRam extends Quest
{
	// NPCs
	private static final int KAHMAN = 31554;
	
	// Items
	private static final int SPLINTER_STAKATO_CHITIN = 7248;
	private static final int NEEDLE_STAKATO_CHITIN = 7249;
	private static final int GOLDEN_RAM_BADGE_RECRUIT = 7246;
	private static final int GOLDEN_RAM_BADGE_SOLDIER = 7247;
	
	// Drop chances
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
	static
	{
		CHANCES.put(21508, 500000);
		CHANCES.put(21509, 430000);
		CHANCES.put(21510, 521000);
		CHANCES.put(21511, 575000);
		CHANCES.put(21512, 746000);
		CHANCES.put(21513, 500000);
		CHANCES.put(21514, 430000);
		CHANCES.put(21515, 520000);
		CHANCES.put(21516, 531000);
		CHANCES.put(21517, 744000);
	}
	
	public Q00628_HuntGoldenRam()
	{
		super(628, "Hunt of the Golden Ram Mercenary Force");
		registerQuestItems(SPLINTER_STAKATO_CHITIN, NEEDLE_STAKATO_CHITIN, GOLDEN_RAM_BADGE_RECRUIT, GOLDEN_RAM_BADGE_SOLDIER);
		addStartNpc(KAHMAN);
		addTalkId(KAHMAN);
		addKillId(CHANCES.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 "31554-02.htm":
			{
				st.startQuest();
				break;
			}
			case "31554-03a.htm":
			{
				if ((getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN) >= 100) && st.isCond(1)) // Giving GOLDEN_RAM_BADGE_RECRUIT Medals
				{
					htmltext = "31554-04.htm";
					st.setCond(2, true);
					takeItems(player, SPLINTER_STAKATO_CHITIN, -1);
					giveItems(player, GOLDEN_RAM_BADGE_RECRUIT, 1);
				}
				break;
			}
			case "31554-07.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() < 66) ? "31554-01a.htm" : "31554-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				if (cond == 1)
				{
					if (getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN) >= 100)
					{
						htmltext = "31554-03.htm";
					}
					else
					{
						htmltext = "31554-03a.htm";
					}
				}
				else if (cond == 2)
				{
					if ((getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN) >= 100) && (getQuestItemsCount(player, NEEDLE_STAKATO_CHITIN) >= 100))
					{
						htmltext = "31554-05.htm";
						st.setCond(3);
						playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);
						takeItems(player, SPLINTER_STAKATO_CHITIN, -1);
						takeItems(player, NEEDLE_STAKATO_CHITIN, -1);
						takeItems(player, GOLDEN_RAM_BADGE_RECRUIT, 1);
						giveItems(player, GOLDEN_RAM_BADGE_SOLDIER, 1);
					}
					else if (!hasQuestItems(player, SPLINTER_STAKATO_CHITIN) && !hasQuestItems(player, NEEDLE_STAKATO_CHITIN))
					{
						htmltext = "31554-04b.htm";
					}
					else
					{
						htmltext = "31554-04a.htm";
					}
				}
				else if (cond == 3)
				{
					htmltext = "31554-05a.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;
		}
		
		final Player partyMember = st.getPlayer();
		final int cond = st.getCond();
		final int npcId = npc.getId();
		switch (npcId)
		{
			case 21508:
			case 21509:
			case 21510:
			case 21511:
			case 21512:
			{
				if (((cond == 1) || (cond == 2)) && (getQuestItemsCount(partyMember, SPLINTER_STAKATO_CHITIN) < 100) && (getRandom(1000000) < CHANCES.get(npcId)))
				{
					giveItems(partyMember, SPLINTER_STAKATO_CHITIN, 1);
					if (getQuestItemsCount(partyMember, SPLINTER_STAKATO_CHITIN) < 100)
					{
						playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
					else
					{
						playSound(partyMember, QuestSound.ITEMSOUND_QUEST_MIDDLE);
					}
				}
				break;
			}
			case 21513:
			case 21514:
			case 21515:
			case 21516:
			case 21517:
			{
				if ((cond == 2) && (getQuestItemsCount(partyMember, NEEDLE_STAKATO_CHITIN) < 100) && (getRandom(1000000) < CHANCES.get(npcId)))
				{
					giveItems(partyMember, NEEDLE_STAKATO_CHITIN, 1);
					if (getQuestItemsCount(partyMember, NEEDLE_STAKATO_CHITIN) < 100)
					{
						playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
					else
					{
						playSound(partyMember, QuestSound.ITEMSOUND_QUEST_MIDDLE);
					}
				}
				break;
			}
		}
	}
}