Support for LongTimeEvent spawns with random heading and set respawn time.
This commit is contained in:
parent
672bea7c26
commit
a9116f1ed8
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:integer" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -44,9 +44,11 @@ import org.l2jmobius.gameserver.data.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.script.DateRange;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
@ -66,24 +68,26 @@ public class LongTimeEvent extends Quest
|
||||
protected String _endMsg = "";
|
||||
protected int _enterAnnounceId = -1;
|
||||
|
||||
// NPCs to spawm and their spawn points
|
||||
// NPCs to spawn and their spawn points
|
||||
protected final List<NpcSpawn> _spawnList = new ArrayList<>();
|
||||
|
||||
// Drop data for event
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
// Items to destroy when event ends
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final int respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, int spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +229,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final int respawnTime = d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("respawnTime").getNodeValue()) : 0;
|
||||
|
||||
if (NpcTable.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -233,7 +238,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -321,9 +326,16 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
// Add spawns.
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd.intValue());
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd.intValue());
|
||||
if (npcSpawn.respawnTime > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(npcSpawn.respawnTime / 1000);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - npcSpawn.respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Event enter announcement.
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:integer" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -44,9 +44,11 @@ import org.l2jmobius.gameserver.data.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.script.DateRange;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
@ -66,24 +68,26 @@ public class LongTimeEvent extends Quest
|
||||
protected String _endMsg = "";
|
||||
protected int _enterAnnounceId = -1;
|
||||
|
||||
// NPCs to spawm and their spawn points
|
||||
// NPCs to spawn and their spawn points
|
||||
protected final List<NpcSpawn> _spawnList = new ArrayList<>();
|
||||
|
||||
// Drop data for event
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
// Items to destroy when event ends
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final int respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, int spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +229,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final int respawnTime = d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("respawnTime").getNodeValue()) : 0;
|
||||
|
||||
if (NpcTable.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -233,7 +238,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -321,9 +326,16 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
// Add spawns.
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd.intValue());
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd.intValue());
|
||||
if (npcSpawn.respawnTime > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(npcSpawn.respawnTime / 1000);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - npcSpawn.respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Event enter announcement.
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:integer" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -44,7 +44,9 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +84,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final int respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, int spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +234,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final int respawnTime = d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("respawnTime").getNodeValue()) : 0;
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -238,7 +243,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -353,9 +358,16 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
if (npcSpawn.respawnTime > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(npcSpawn.respawnTime);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - npcSpawn.respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:integer" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -44,7 +44,9 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +84,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final int respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, int spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +234,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final int respawnTime = d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("respawnTime").getNodeValue()) : 0;
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -238,7 +243,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -353,9 +358,16 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
if (npcSpawn.respawnTime > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(npcSpawn.respawnTime);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - npcSpawn.respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:integer" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -44,7 +44,9 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +84,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final int respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, int spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +234,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final int respawnTime = d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("respawnTime").getNodeValue()) : 0;
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -238,7 +243,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -353,9 +358,16 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
if (npcSpawn.respawnTime > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(npcSpawn.respawnTime);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - npcSpawn.respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,13 +37,16 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -81,13 +85,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +245,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -247,7 +254,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -365,9 +372,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<xs:attribute name="x" type="xs:integer" use="required" />
|
||||
<xs:attribute name="y" type="xs:integer" use="required" />
|
||||
<xs:attribute name="z" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="required" />
|
||||
<xs:attribute name="heading" type="xs:integer" use="optional" />
|
||||
<xs:attribute name="respawnTime" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@ -21,6 +21,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -36,6 +37,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.TimeUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@ -43,7 +45,9 @@ import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.announce.EventAnnouncement;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@ -82,13 +86,15 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
protected final Location loc;
|
||||
protected final int npcId;
|
||||
protected final Location loc;
|
||||
protected final Duration respawnTime;
|
||||
|
||||
protected NpcSpawn(int pNpcId, Location spawnLoc)
|
||||
protected NpcSpawn(int spawnNpcId, Location spawnLoc, Duration spawnRespawnTime)
|
||||
{
|
||||
npcId = spawnNpcId;
|
||||
loc = spawnLoc;
|
||||
npcId = pNpcId;
|
||||
respawnTime = spawnRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,8 @@ public class LongTimeEvent extends Quest
|
||||
final int xPos = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
final int yPos = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
final int zPos = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : 0;
|
||||
final int heading = d.getAttributes().getNamedItem("heading").getNodeValue() != null ? Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()) : -1;
|
||||
final Duration respawnTime = TimeUtil.parseDuration(d.getAttributes().getNamedItem("respawnTime").getNodeValue() != null ? d.getAttributes().getNamedItem("respawnTime").getNodeValue() : "0sec");
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
@ -248,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
continue;
|
||||
}
|
||||
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading)));
|
||||
_spawnList.add(new NpcSpawn(npcId, new Location(xPos, yPos, zPos, heading), respawnTime));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
@ -373,9 +380,17 @@ public class LongTimeEvent extends Quest
|
||||
private final Consumer<OnServerStart> _spawnNpcs = event ->
|
||||
{
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
for (NpcSpawn npcSpawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final Npc npc = addSpawn(npcSpawn.npcId, npcSpawn.loc.getX(), npcSpawn.loc.getY(), npcSpawn.loc.getZ(), npcSpawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
final int respawnDelay = (int) npcSpawn.respawnTime.toMillis();
|
||||
if (respawnDelay > 0)
|
||||
{
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
spawn.setRespawnDelay(respawnDelay);
|
||||
spawn.startRespawn();
|
||||
ThreadPool.schedule(spawn::stopRespawn, millisToEventEnd - respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Containers.Global().removeListenerIf(EventType.ON_SERVER_START, listener -> listener.getOwner() == this);
|
||||
|
Loading…
Reference in New Issue
Block a user