Skip to content
Snippets Groups Projects
Commit 2a55ef89 authored by malyelfik's avatar malyelfik
Browse files

BETA: Updating quest '''Rumble in the Base (461)'''

parent 070982b0
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
*/ */
package quests.Q00461_RumbleInTheBase; package quests.Q00461_RumbleInTheBase;
import java.util.HashMap;
import java.util.Map;
import quests.Q00252_ItSmellsDelicious.Q00252_ItSmellsDelicious; import quests.Q00252_ItSmellsDelicious.Q00252_ItSmellsDelicious;
import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Npc;
...@@ -30,26 +33,30 @@ import com.l2jserver.gameserver.model.quest.State; ...@@ -30,26 +33,30 @@ import com.l2jserver.gameserver.model.quest.State;
public class Q00461_RumbleInTheBase extends Quest public class Q00461_RumbleInTheBase extends Quest
{ {
// NPC // NPC
public static final int Stan = 30200; private static final int STAN = 30200;
public static final int[] Monsters =
{
22780,
22781,
22782,
2278,
22784,
22785,
18908
};
// Item // Item
public static final int ShinySalmon = 15503; private static final int SHINY_SALMON = 15503;
public static final int ShoesStringOfSelMahum = 16382; private static final int SHOES_STRING_OF_SEL_MAHUM = 16382;
// Mobs
private static final Map<Integer, Integer> MONSTERS = new HashMap<>();
static
{
MONSTERS.put(22780, 581);
MONSTERS.put(22781, 772);
MONSTERS.put(22782, 581);
MONSTERS.put(22783, 563);
MONSTERS.put(22784, 581);
MONSTERS.put(22785, 271);
MONSTERS.put(18908, 782);
}
@Override @Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{ {
String htmltext = event; String htmltext = null;
final QuestState st = player.getQuestState(getName()); final QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
...@@ -58,9 +65,12 @@ public class Q00461_RumbleInTheBase extends Quest ...@@ -58,9 +65,12 @@ public class Q00461_RumbleInTheBase extends Quest
if (event.equalsIgnoreCase("30200-05.htm")) if (event.equalsIgnoreCase("30200-05.htm"))
{ {
st.set("cond", "1"); st.startQuest();
st.setState(State.STARTED); htmltext = event;
st.playSound("ItemSound.quest_accept"); }
else if (event.equalsIgnoreCase("30200-04.htm"))
{
htmltext = event;
} }
return htmltext; return htmltext;
} }
...@@ -82,17 +92,14 @@ public class Q00461_RumbleInTheBase extends Quest ...@@ -82,17 +92,14 @@ public class Q00461_RumbleInTheBase extends Quest
htmltext = ((player.getLevel() >= 82) && (prev != null) && prev.isCompleted()) ? "30200-01.htm" : "30200-02.htm"; htmltext = ((player.getLevel() >= 82) && (prev != null) && prev.isCompleted()) ? "30200-01.htm" : "30200-02.htm";
break; break;
case State.STARTED: case State.STARTED:
if (st.getInt("cond") == 1) if (st.isCond(1))
{ {
htmltext = "30200-06.html"; htmltext = "30200-06.html";
} }
else else
{ {
st.takeItems(ShinySalmon, -1);
st.takeItems(ShoesStringOfSelMahum, -1);
st.addExpAndSp(224784, 342528); st.addExpAndSp(224784, 342528);
st.playSound("ItemSound.quest_finish"); st.exitQuest(QuestType.DAILY, true);
st.exitQuest(QuestType.DAILY);
htmltext = "30200-07.html"; htmltext = "30200-07.html";
} }
break; break;
...@@ -114,88 +121,55 @@ public class Q00461_RumbleInTheBase extends Quest ...@@ -114,88 +121,55 @@ public class Q00461_RumbleInTheBase extends Quest
@Override @Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
{ {
final L2PcInstance partyMember = getRandomPartyMember(player, "1"); QuestState st = null;
if (partyMember == null) if (getRandom(1000) >= MONSTERS.get(npc.getNpcId()))
{ {
return null; return super.onKill(npc, player, isPet);
} }
final QuestState st = partyMember.getQuestState(getName()); if (npc.getNpcId() == 18908)
int chance = getRandom(1000);
boolean giveItem = false;
switch (npc.getNpcId())
{ {
case 22780: st = player.getQuestState(getName());
if (chance < 581) if ((st != null) && st.isCond(1) && (st.getQuestItemsCount(SHINY_SALMON) < 5))
{ {
giveItem = true; st.giveItems(SHINY_SALMON, 1);
} st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
break; if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10))
case 22781:
if (chance < 772)
{
giveItem = true;
}
break;
case 22782:
if (chance < 581)
{
giveItem = true;
}
break;
case 22783:
if (chance < 563)
{ {
giveItem = true; st.setCond(2, true);
} }
break; }
case 22784:
if (chance < 581)
{
giveItem = true;
}
break;
case 22785:
if (chance < 271)
{
giveItem = true;
}
break;
case 18908:
if ((chance < 271) && (st.getQuestItemsCount(ShinySalmon) < 5))
{
st.giveItems(ShinySalmon, 1);
st.playSound("ItemSound.quest_itemget");
}
break;
}
if (giveItem && (st.getQuestItemsCount(ShoesStringOfSelMahum) < 10))
{
st.giveItems(ShoesStringOfSelMahum, 1);
st.playSound("ItemSound.quest_itemget");
} }
else
if ((st.getQuestItemsCount(ShinySalmon) == 5) && (st.getQuestItemsCount(ShoesStringOfSelMahum) == 10))
{ {
st.set("cond", "2"); final L2PcInstance member = getRandomPartyMember(player, "1");
st.playSound("ItemSound.quest_middle"); if (member == null)
{
return super.onKill(npc, player, isPet);
}
st = member.getQuestState(getName());
if (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) < 10)
{
st.giveItems(SHOES_STRING_OF_SEL_MAHUM, 1);
st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10))
{
st.setCond(2, true);
}
}
} }
return null; return super.onKill(npc, player, isPet);
} }
public Q00461_RumbleInTheBase(int questId, String name, String descr) public Q00461_RumbleInTheBase(int questId, String name, String descr)
{ {
super(questId, name, descr); super(questId, name, descr);
addStartNpc(Stan); addStartNpc(STAN);
addTalkId(Stan); addTalkId(STAN);
addKillId(Monsters); addKillId(MONSTERS.keySet());
questItemIds = new int[] registerQuestItems(SHINY_SALMON, SHOES_STRING_OF_SEL_MAHUM);
{
ShinySalmon,
ShoesStringOfSelMahum
};
} }
public static void main(String[] args) public static void main(String[] args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment