Skip to content
Snippets Groups Projects
Commit b9f401a0 authored by Adry_85's avatar Adry_85
Browse files

BETA: Improvements for quest '''Journey to a Settlement''' (654).

	Reviewed by: jurchiks
	* Fixed minor bug when quest start.
		* Reported by: !CostyKiller
parent 91777c1b
No related branches found
No related tags found
No related merge requests found
<html><body>Nameless Spirit:<br> <html><body>Nameless Spirit:<br>
Oh, hello again! Yes, I spoke with Wigoth, and he assures me that this song is the one! <font color="LEVEL">We can now pass through the force field.</font> It brings us one step closer to him, eh?<br>By the way, <font color="LEVEL">could you help me put Frintezza to sleep</font>? As I said, we can't eliminate Frintezza completely with our power at its current level... But we can wait until he wakes up and then put him back to sleep before he can act!<br> Oh, hello again! Yes, I spoke with Wigoth, and he assures me that this song is the one! <font color="LEVEL">We can now pass through the force field.</font> It brings us one step closer to him, eh?<br>By the way, <font color="LEVEL">could you help me put Frintezza to sleep</font>? As I said, we can't eliminate Frintezza completely with our power at its current level... But we can wait until he wakes up and then put him back to sleep before he can act!<br>
<a action="bypass -h Quest Q00654_JourneyToASettlement 31453-02.html">"I'll help you."</a> <a action="bypass -h Quest Q00654_JourneyToASettlement 31453-02.htm">"I'll help you."</a>
</body></html> </body></html>
\ No newline at end of file
...@@ -23,19 +23,16 @@ import java.util.Map; ...@@ -23,19 +23,16 @@ import java.util.Map;
import quests.Q00119_LastImperialPrince.Q00119_LastImperialPrince; import quests.Q00119_LastImperialPrince.Q00119_LastImperialPrince;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.QuestSound;
import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
/** /**
* Journey to a Settlement (654) * Journey to a Settlement (654)
* @author Adry_85 * @author Adry_85
*/ */
public class Q00654_JourneyToASettlement extends Quest public final class Q00654_JourneyToASettlement extends Quest
{ {
// NPC // NPC
private static final int NAMELESS_SPIRIT = 31453; private static final int NAMELESS_SPIRIT = 31453;
...@@ -45,17 +42,16 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -45,17 +42,16 @@ public class Q00654_JourneyToASettlement extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 74; private static final int MIN_LEVEL = 74;
private static final Map<Integer, Integer> MOBS_SKIN = new HashMap<>(); private static final Map<Integer, Double> MOBS_SKIN = new HashMap<>();
static static
{ {
MOBS_SKIN.put(21294, 840); // Canyon Antelope MOBS_SKIN.put(21294, 0.840); // Canyon Antelope
MOBS_SKIN.put(21295, 893); // Canyon Antelope Slave MOBS_SKIN.put(21295, 0.893); // Canyon Antelope Slave
} }
public Q00654_JourneyToASettlement(int id, String name, String descr) private Q00654_JourneyToASettlement()
{ {
super(id, name, descr); super(654, Q00654_JourneyToASettlement.class.getSimpleName(), "Journey to a Settlement");
addStartNpc(NAMELESS_SPIRIT); addStartNpc(NAMELESS_SPIRIT);
addTalkId(NAMELESS_SPIRIT); addTalkId(NAMELESS_SPIRIT);
addKillId(MOBS_SKIN.keySet()); addKillId(MOBS_SKIN.keySet());
...@@ -65,7 +61,7 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -65,7 +61,7 @@ public class Q00654_JourneyToASettlement extends Quest
@Override @Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{ {
final QuestState st = player.getQuestState(getName()); final QuestState st = getQuestState(player, false);
if (st == null) if (st == null)
{ {
return null; return null;
...@@ -74,25 +70,27 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -74,25 +70,27 @@ public class Q00654_JourneyToASettlement extends Quest
String htmltext = null; String htmltext = null;
switch (event) switch (event)
{ {
case "31453-02.html": case "31453-02.htm":
{ {
st.startQuest(); st.startQuest();
st.setMemoState(1);
htmltext = event; htmltext = event;
break; break;
} }
case "31453-03.html": case "31453-03.html":
{ {
if (st.isCond(1)) if (st.isMemoState(1))
{ {
st.setMemoState(2);
st.setCond(2, true); st.setCond(2, true);
htmltext = event; htmltext = event;
} }
} }
case "31453-07.html": case "31453-07.html":
{ {
if (st.isCond(3) && st.hasQuestItems(ANTELOPE_SKIN)) if (st.isMemoState(2) && st.hasQuestItems(ANTELOPE_SKIN))
{ {
st.giveItems(FRINTEZZAS_SCROLL, 1); giveItems(player, FRINTEZZAS_SCROLL, 1);
st.exitQuest(true, true); st.exitQuest(true, true);
htmltext = event; htmltext = event;
} }
...@@ -104,20 +102,10 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -104,20 +102,10 @@ public class Q00654_JourneyToASettlement extends Quest
@Override @Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{ {
final L2PcInstance partyMember = getRandomPartyMember(player, 2); final QuestState st = getRandomPartyMemberState(player, 2, 3, npc);
if (partyMember == null) if (st != null)
{
return super.onKill(npc, player, isSummon);
}
final QuestState st = partyMember.getQuestState(getName());
int npcId = npc.getId();
float chance = (MOBS_SKIN.get(npcId) * Config.RATE_QUEST_DROP);
if (getRandom(1000) < chance)
{ {
st.rewardItems(ANTELOPE_SKIN, 1); giveItemRandomly(st.getPlayer(), npc, ANTELOPE_SKIN, 1, 1, MOBS_SKIN.get(npc.getId()), true);
st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
st.setCond(3, true);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }
...@@ -125,32 +113,24 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -125,32 +113,24 @@ public class Q00654_JourneyToASettlement extends Quest
@Override @Override
public String onTalk(L2Npc npc, L2PcInstance player) public String onTalk(L2Npc npc, L2PcInstance player)
{ {
QuestState st = player.getQuestState(getName()); QuestState st = getQuestState(player, true);
String htmltext = getNoQuestMsg(player); String htmltext = getNoQuestMsg(player);
if (st == null) if (st.isCreated())
{ {
return htmltext; st = player.getQuestState(Q00119_LastImperialPrince.class.getSimpleName());
htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "31453-01.htm" : "31453-04.htm";
} }
else if (st.isStarted())
switch (st.getState())
{ {
case State.CREATED: if (st.isMemoState(1))
{ {
st = player.getQuestState(Q00119_LastImperialPrince.class.getSimpleName()); st.setMemoState(2);
htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "31453-01.htm" : "31453-04.html"; st.setCond(2, true);
break; htmltext = "31453-03.html";
} }
case State.STARTED: else if (st.isMemoState(2))
{ {
if (st.isCond(2)) htmltext = (hasQuestItems(player, ANTELOPE_SKIN) ? "31453-06.html" : "31453-05.html");
{
htmltext = "31453-05.html";
}
else if (st.isCond(3))
{
htmltext = "31453-06.html";
}
break;
} }
} }
return htmltext; return htmltext;
...@@ -158,6 +138,6 @@ public class Q00654_JourneyToASettlement extends Quest ...@@ -158,6 +138,6 @@ public class Q00654_JourneyToASettlement extends Quest
public static void main(String[] args) public static void main(String[] args)
{ {
new Q00654_JourneyToASettlement(654, Q00654_JourneyToASettlement.class.getSimpleName(), "Journey to a Settlement"); new Q00654_JourneyToASettlement();
} }
} }
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