From d7ee7eb33f5c40b2699e003add9a1ed9ed09629d Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Sun, 22 Mar 2020 12:01:54 +0000
Subject: [PATCH] Removed Completely Lost repeated quest timer.
---
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 1 -
.../Q00454_CompletelyLost.java | 55 +-
.../data/spawns/Gracia/SeedOfAnnihilation.xml | 601 +++++++++---------
.../Q00454_CompletelyLost.java | 99 ++-
.../game/data/spawns/injured_soldiers.xml | 10 +
18 files changed, 502 insertions(+), 655 deletions(-)
create mode 100644 L2J_Mobius_CT_2.6_HighFive/dist/game/data/spawns/injured_soldiers.xml
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_5.0_Salvation/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_5.5_EtinasFate/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_6.0_Fafurion/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..403075e3f4 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -187,7 +187,6 @@
-
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index dce8fc54ad..fd7e6ddba9 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -40,7 +41,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -56,7 +57,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -67,15 +67,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP));
break;
}
@@ -289,18 +282,6 @@ public class Q00454_CompletelyLost extends Quest
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
@@ -312,7 +293,7 @@ public class Q00454_CompletelyLost extends Quest
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -398,18 +379,28 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackPlayerDesire(npc, creature.getActingPlayer(), 10);
}
@@ -757,21 +748,13 @@ public class Q00454_CompletelyLost extends Quest
public TerminateReturn onAttacked(OnCreatureAttacked event)
{
final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
+ npc.setScriptValue(1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
startQuestTimer("SAY_TIMER1", 2000, npc, null);
return new TerminateReturn(true, false, false);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
/**
* Send a whisper to the given player.
* @param npc the NPC
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
index 5b79609173..fad08b17cc 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml
@@ -1,301 +1,300 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
index 1b1a16fb12..ed35d9e869 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -41,7 +42,7 @@ import org.l2jmobius.gameserver.util.Util;
/**
* Completely Lost (454)
- * @author Zoey76
+ * @author Zoey76, Mobius
*/
public class Q00454_CompletelyLost extends Quest
{
@@ -57,7 +58,6 @@ public class Q00454_CompletelyLost extends Quest
super(454);
addStartNpc(INJURED_SOLDIER);
addTalkId(INJURED_SOLDIER, ERMIAN);
- addSpawnId(ERMIAN);
addMoveFinishedId(INJURED_SOLDIER);
addSeeCreatureId(INJURED_SOLDIER);
addEventReceivedId(INJURED_SOLDIER);
@@ -68,15 +68,8 @@ public class Q00454_CompletelyLost extends Quest
{
switch (event)
{
- case "QUEST_TIMER":
- {
- npc.broadcastEvent("SCE_IM_ERMIAN", 300, null);
- startQuestTimer("QUEST_TIMER", 100, npc, null);
- break;
- }
case "SAY_TIMER1":
{
- // TODO: npc.changeStatus(3);
broadcastNpcSay(npc, NpcStringId.GASP);
break;
}
@@ -193,7 +186,7 @@ public class Q00454_CompletelyLost extends Quest
{
case "32738-04.htm":
{
- if (qs.isCreated() && qs.isNowAvailable() && (player.getLevel() >= MIN_LEVEL))
+ if (player.getLevel() >= MIN_LEVEL)
{
if (npc.getVariables().getInt("quest_escort", 0) == 0)
{
@@ -255,20 +248,17 @@ public class Q00454_CompletelyLost extends Quest
htmltext = "32738-06.html";
npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_START", npc, null);
final PlayerInstance leader = npc.getVariables().getObject("leader", PlayerInstance.class);
- if (leader != null)
+ if ((leader != null) && leader.isInParty())
{
- if (leader.isInParty())
+ for (PlayerInstance member : leader.getParty().getMembers())
{
- for (PlayerInstance member : leader.getParty().getMembers())
+ if (member != null)
{
- if (member != null)
+ final QuestState qsMember = getQuestState(member, false);
+ if ((qsMember != null) && qsMember.isMemoState(1) //
+ && (npc.getVariables().getInt("partyId", 0) == leader.getParty().getLeaderObjectId()))
{
- final QuestState qsMember = getQuestState(member, false);
- if ((qsMember != null) && qsMember.isMemoState(1) //
- && (npc.getVariables().getInt("partyId", 0) == leader.getParty().getLeaderObjectId()))
- {
- qsMember.setMemoState(2);
- }
+ qsMember.setMemoState(2);
}
}
}
@@ -288,48 +278,23 @@ public class Q00454_CompletelyLost extends Quest
return htmltext;
}
- @RegisterEvent(EventType.ON_CREATURE_ATTACKED)
- @RegisterType(ListenerRegisterType.NPC)
- @Id(INJURED_SOLDIER)
- public TerminateReturn onAttacked(OnCreatureAttacked event)
- {
- final Npc npc = (Npc) event.getTarget();
- // TODO: npc.changeStatus(2);
- npc.getVariables().set("state", 1);
- npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
- startQuestTimer("SAY_TIMER1", 2000, npc, null);
- return new TerminateReturn(true, false, false);
- }
-
@Override
public String onEventReceived(String eventName, Npc sender, Npc receiver, WorldObject reference)
{
switch (eventName)
{
- case "SCE_IM_ERMIAN":
- {
- if (receiver.getVariables().getInt("state", 0) == 2)
- {
- receiver.getVariables().set("state", 3);
- receiver.getVariables().set("ermian", sender);
- receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- addMoveToDesire(receiver, MOVE_TO, 10000000);
- receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null);
- }
- break;
- }
case "SCE_A_SEED_ESCORT_QUEST_START":
{
final PlayerInstance leader = receiver.getVariables().getObject("leader", PlayerInstance.class);
if (leader != null)
{
+ receiver.setTarget(leader);
receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, leader);
}
startQuestTimer("CHECK_TIMER", 1000, receiver, null);
startQuestTimer("TIME_LIMIT1", 60000, receiver, null);
- receiver.getVariables().set("state", 2);
+ receiver.setScriptValue(2);
receiver.getVariables().set("quest_escort", 99);
break;
}
@@ -415,31 +380,34 @@ public class Q00454_CompletelyLost extends Quest
@Override
public void onMoveFinished(Npc npc)
{
- final Npc ermian = npc.getVariables().getObject("ermian", Npc.class);
- if (ermian != null)
+ if (npc.isScriptValue(2))
{
- npc.setHeading(Util.calculateHeadingFrom(npc, ermian));
- startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 300))
+ {
+ if (nearby.getId() == ERMIAN)
+ {
+ npc.setScriptValue(3);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ addMoveToDesire(npc, MOVE_TO, 10000000);
+ npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", npc, null);
+ npc.setHeading(Util.calculateHeadingFrom(npc, nearby));
+ startQuestTimer("SAY_TIMER2", 2000, npc, null);
+ break;
+ }
+ }
}
}
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
- if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0))
+ if (creature.isPlayer() && npc.isScriptValue(0))
{
addAttackDesire(npc, creature.getActingPlayer(), 10);
}
return super.onSeeCreature(npc, creature, isSummon);
}
- @Override
- public String onSpawn(Npc npc)
- {
- startQuestTimer("QUEST_TIMER", 1000, npc, null);
- return super.onSpawn(npc);
- }
-
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
@@ -775,6 +743,19 @@ public class Q00454_CompletelyLost extends Quest
return htmltext;
}
+ @RegisterEvent(EventType.ON_CREATURE_ATTACKED)
+ @RegisterType(ListenerRegisterType.NPC)
+ @Id(INJURED_SOLDIER)
+ public TerminateReturn onAttacked(OnCreatureAttacked event)
+ {
+ final Npc npc = (Npc) event.getTarget();
+ npc.setScriptValue(1);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+ startQuestTimer("SAY_TIMER1", 2000, npc, null);
+ return new TerminateReturn(true, false, false);
+ }
+
/**
* Broadcast NPC string to all known players.
* @param npc the NPC
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/spawns/injured_soldiers.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/spawns/injured_soldiers.xml
new file mode 100644
index 0000000000..7d62358797
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/spawns/injured_soldiers.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file