Fixed instance loading.
This commit is contained in:
@ -259,15 +259,15 @@ public final class GameServer
|
||||
}
|
||||
|
||||
printSection("NPCs");
|
||||
DoorData.getInstance();
|
||||
SkillLearnData.getInstance();
|
||||
NpcData.getInstance();
|
||||
WalkingManager.getInstance();
|
||||
StaticObjectData.getInstance();
|
||||
ZoneManager.getInstance();
|
||||
DoorData.getInstance();
|
||||
ItemAuctionManager.getInstance();
|
||||
CastleManager.getInstance().loadInstances();
|
||||
NpcBufferTable.getInstance();
|
||||
ZoneManager.getInstance();
|
||||
GrandBossManager.getInstance().initZones();
|
||||
EventDroplist.getInstance();
|
||||
|
||||
|
@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
public final class DuelManager
|
||||
{
|
||||
private static final List<String> ARENAS = Arrays.asList("OlympiadGrassyArena.xml", "OlympiadHerossVestigesArena.xml", "OlympiadOrbisArena.xml", "OlympiadThreeBridgesArena.xml");
|
||||
private static final List<String> ARENAS = Arrays.asList("OlympiadGrassyArena.xml", "OlympiadThreeBridgesArena.xml", "OlympiadHerossVestigesArena.xml", "OlympiadOrbisArena.xml");
|
||||
private final Map<Integer, Duel> _duels = new ConcurrentHashMap<>();
|
||||
private final AtomicInteger _currentDuelId = new AtomicInteger();
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.w3c.dom.Node;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
|
||||
/**
|
||||
@ -312,22 +312,6 @@ public final class InstanceManager implements IGameXmlReader
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean createInstance(int id)
|
||||
{
|
||||
if (getInstance(id) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Instance instance = new Instance(id);
|
||||
INSTANCES.put(id, instance);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param template
|
||||
@ -343,6 +327,8 @@ public final class InstanceManager implements IGameXmlReader
|
||||
final Instance instance = new Instance(id);
|
||||
INSTANCES.put(id, instance);
|
||||
instance.loadInstanceTemplate(template);
|
||||
instance.spawnDoors();
|
||||
instance.spawnGroup("general");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -367,6 +353,8 @@ public final class InstanceManager implements IGameXmlReader
|
||||
if (template != null)
|
||||
{
|
||||
instance.loadInstanceTemplate(template);
|
||||
instance.spawnDoors();
|
||||
instance.spawnGroup("general");
|
||||
}
|
||||
return _dynamic;
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2SiegeFlagInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.ClanHall;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegableHall;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2ClanHallZone;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2RespawnZone;
|
||||
|
||||
|
@ -32,8 +32,8 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.poly.ObjectPoly;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IDecayable;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
|
@ -81,7 +81,6 @@ import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||
import com.l2jmobius.gameserver.model.actor.transform.TransformTemplate;
|
||||
import com.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
@ -99,6 +98,7 @@ import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.holders.InvulSkillHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IDeletable;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ISkillsHolder;
|
||||
|
@ -27,10 +27,10 @@ import com.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2CharTemplate;
|
||||
import com.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureKill;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.EtcStatusUpdate;
|
||||
|
@ -44,8 +44,8 @@ import com.l2jmobius.gameserver.model.actor.templates.L2DoorTemplate;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.ClanHall;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegableHall;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
@ -186,7 +186,6 @@ import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Duel;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.entity.Hero;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.entity.L2Event;
|
||||
import com.l2jmobius.gameserver.model.entity.NevitSystem;
|
||||
import com.l2jmobius.gameserver.model.entity.Siege;
|
||||
@ -212,6 +211,7 @@ import com.l2jmobius.gameserver.model.holders.PlayerEventHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IEventListener;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
|
@ -595,16 +595,13 @@ public class Duel
|
||||
}
|
||||
|
||||
final String instanceName = DuelManager.getInstance().getDuelArena();
|
||||
final L2OlympiadStadiumZone zone = ZoneManager.getInstance().getAllZones(L2OlympiadStadiumZone.class) //
|
||||
.stream().filter(z -> z.getInstanceTemplate().equals(instanceName)).findFirst().orElse(null);
|
||||
|
||||
_duelInstanceId = InstanceManager.getInstance().createDynamicInstance(instanceName);
|
||||
final L2OlympiadStadiumZone zone = ZoneManager.getInstance().getZone(InstanceManager.getInstance().getInstance(_duelInstanceId).getNpcs().get(0), L2OlympiadStadiumZone.class);
|
||||
if (zone == null)
|
||||
{
|
||||
throw new RuntimeException("Unable to find a party duel arena!");
|
||||
}
|
||||
|
||||
final List<Location> spawns = zone.getSpawns();
|
||||
_duelInstanceId = InstanceManager.getInstance().createDynamicInstance(instanceName);
|
||||
|
||||
// Remove Olympiad buffers
|
||||
for (L2Npc buffer : InstanceManager.getInstance().getInstance(getDueldInstanceId()).getNpcs())
|
||||
|
@ -47,6 +47,7 @@ import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventFinish;
|
||||
import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventKill;
|
||||
import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventRegistrationStart;
|
||||
import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventStart;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
@ -57,7 +57,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Id;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Ids;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.NpcLevelRange;
|
||||
@ -111,6 +110,7 @@ import com.l2jmobius.gameserver.model.events.returns.AbstractEventReturn;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
|
@ -14,14 +14,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.entity;
|
||||
package com.l2jmobius.gameserver.model.instancezone;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.DayOfWeek;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -56,7 +55,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2DoorTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.InstanceReenterTimeHolder;
|
||||
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
@ -68,7 +66,7 @@ import com.l2jmobius.gameserver.util.Broadcast;
|
||||
*/
|
||||
public final class Instance
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(Instance.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(Instance.class.getName());
|
||||
|
||||
private final int _id;
|
||||
private String _name;
|
||||
@ -77,8 +75,9 @@ public final class Instance
|
||||
private boolean _allowRandomWalk = true;
|
||||
private final List<Integer> _players = new CopyOnWriteArrayList<>();
|
||||
private final List<L2Npc> _npcs = new CopyOnWriteArrayList<>();
|
||||
private final List<StatsSet> _doorTemplates = new CopyOnWriteArrayList<>();
|
||||
private final Map<Integer, L2DoorInstance> _doors = new ConcurrentHashMap<>();
|
||||
private final Map<String, List<L2Spawn>> _manualSpawn = new HashMap<>();
|
||||
private final List<StatsSet> _spawnTemplates = new CopyOnWriteArrayList<>();
|
||||
// private StartPosType _enterLocationOrder; TODO implement me
|
||||
private List<Location> _enterLocations = null;
|
||||
private Location _exitLocation = null;
|
||||
@ -260,22 +259,35 @@ public final class Instance
|
||||
|
||||
/**
|
||||
* Adds a door into the instance
|
||||
* @param doorId - from Doors.xml
|
||||
* @param set - StatsSet for initializing door
|
||||
*/
|
||||
public void addDoor(int doorId, StatsSet set)
|
||||
public void addDoor(StatsSet set)
|
||||
{
|
||||
if (_doors.containsKey(doorId))
|
||||
if (_doorTemplates.contains(set))
|
||||
{
|
||||
_log.warning("Door ID " + doorId + " already exists in instance " + getId());
|
||||
LOGGER.warning("Door ID " + set.getInt("DoorId") + " already exists in instance " + getId());
|
||||
return;
|
||||
}
|
||||
|
||||
final L2DoorInstance newdoor = new L2DoorInstance(new L2DoorTemplate(set));
|
||||
newdoor.setInstanceId(getId());
|
||||
newdoor.setCurrentHp(newdoor.getMaxHp());
|
||||
newdoor.spawnMe(newdoor.getTemplate().getX(), newdoor.getTemplate().getY(), newdoor.getTemplate().getZ());
|
||||
_doors.put(doorId, newdoor);
|
||||
_doorTemplates.add(set);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn doors inside instance world.
|
||||
*/
|
||||
public void spawnDoors()
|
||||
{
|
||||
for (StatsSet template : _doorTemplates)
|
||||
{
|
||||
// Create new door instance
|
||||
final int doorId = template.getInt("DoorId");
|
||||
final StatsSet doorTemplate = DoorData.getInstance().getDoorTemplate(doorId);
|
||||
final L2DoorInstance newdoor = new L2DoorInstance(new L2DoorTemplate(doorTemplate));
|
||||
newdoor.setInstanceId(getId());
|
||||
newdoor.setCurrentHp(newdoor.getMaxHp());
|
||||
newdoor.spawnMe(newdoor.getTemplate().getX(), newdoor.getTemplate().getY(), newdoor.getTemplate().getZ());
|
||||
|
||||
_doors.put(doorId, newdoor);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getPlayers()
|
||||
@ -392,7 +404,6 @@ public final class Instance
|
||||
}
|
||||
}
|
||||
_npcs.clear();
|
||||
_manualSpawn.clear();
|
||||
}
|
||||
|
||||
public void removeDoors()
|
||||
@ -416,29 +427,51 @@ public final class Instance
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns group of instance NPC's
|
||||
* Spawns group of instance NPCs
|
||||
* @param groupName - name of group from XML definition to spawn
|
||||
* @return list of spawned NPC's
|
||||
* @return list of spawned NPCs
|
||||
*/
|
||||
public List<L2Npc> spawnGroup(String groupName)
|
||||
{
|
||||
List<L2Npc> ret = null;
|
||||
if (_manualSpawn.containsKey(groupName))
|
||||
List<L2Npc> spawnedNpcs = new ArrayList<>();
|
||||
for (StatsSet set : _spawnTemplates)
|
||||
{
|
||||
final List<L2Spawn> manualSpawn = _manualSpawn.get(groupName);
|
||||
ret = new ArrayList<>(manualSpawn.size());
|
||||
|
||||
for (L2Spawn spawnDat : manualSpawn)
|
||||
if (set.getString("spawnGroup").equals(groupName))
|
||||
{
|
||||
ret.add(spawnDat.doSpawn());
|
||||
try
|
||||
{
|
||||
final L2Spawn spawnDat = new L2Spawn(set.getInt("npcId"));
|
||||
|
||||
spawnDat.setX(set.getInt("x"));
|
||||
spawnDat.setY(set.getInt("y"));
|
||||
spawnDat.setZ(set.getInt("z"));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setHeading(set.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(set.getInt("respawn"), set.getInt("respawnRandom"));
|
||||
if (set.getInt("respawn") == 0)
|
||||
{
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
spawnDat.setInstanceId(getId());
|
||||
spawnDat.setIsNoRndWalk(set.getBoolean("allowRandomWalk"));
|
||||
final L2Npc spawned = spawnDat.doSpawn();
|
||||
if ((set.getInt("delay") >= 0) && (spawned instanceof L2Attackable))
|
||||
{
|
||||
((L2Attackable) spawned).setOnKillDelay(set.getInt("delay"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(getName() + " instance: cannot spawn NPC's, wrong group name: " + groupName);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return spawnedNpcs;
|
||||
}
|
||||
|
||||
public void loadInstanceTemplate(String filename)
|
||||
@ -463,11 +496,11 @@ public final class Instance
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Instance: can not find " + xml.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
LOGGER.log(Level.WARNING, "Instance: can not find " + xml.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Instance: error while loading " + xml.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
LOGGER.log(Level.WARNING, "Instance: error while loading " + xml.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,7 +586,7 @@ public final class Instance
|
||||
{
|
||||
doorId = Integer.parseInt(d.getAttributes().getNamedItem("doorId").getNodeValue());
|
||||
final StatsSet set = new StatsSet();
|
||||
set.add(DoorData.getInstance().getDoorTemplate(doorId));
|
||||
set.set("DoorId", doorId);
|
||||
for (Node bean = d.getFirstChild(); bean != null; bean = bean.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(bean.getNodeName()))
|
||||
@ -564,7 +597,7 @@ public final class Instance
|
||||
set.set(setname, value);
|
||||
}
|
||||
}
|
||||
addDoor(doorId, set);
|
||||
addDoor(set);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -576,14 +609,12 @@ public final class Instance
|
||||
if ("group".equalsIgnoreCase(group.getNodeName()))
|
||||
{
|
||||
final String spawnGroup = group.getAttributes().getNamedItem("name").getNodeValue();
|
||||
final List<L2Spawn> manualSpawn = new ArrayList<>();
|
||||
for (Node d = group.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
int npcId = 0, x = 0, y = 0, z = 0, heading = 0, respawn = 0, respawnRandom = 0, delay = -1;
|
||||
Boolean allowRandomWalk = null;
|
||||
if ("spawn".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
|
||||
npcId = Integer.parseInt(d.getAttributes().getNamedItem("npcId").getNodeValue());
|
||||
x = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
y = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
@ -603,49 +634,27 @@ public final class Instance
|
||||
allowRandomWalk = Boolean.valueOf(d.getAttributes().getNamedItem("allowRandomWalk").getNodeValue());
|
||||
}
|
||||
|
||||
final L2Spawn spawnDat = new L2Spawn(npcId);
|
||||
spawnDat.setX(x);
|
||||
spawnDat.setY(y);
|
||||
spawnDat.setZ(z);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setHeading(heading);
|
||||
spawnDat.setRespawnDelay(respawn, respawnRandom);
|
||||
if (respawn == 0)
|
||||
{
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
spawnDat.setInstanceId(getId());
|
||||
final StatsSet spawnSet = new StatsSet();
|
||||
spawnSet.set("spawnGroup", spawnGroup);
|
||||
spawnSet.set("npcId", npcId);
|
||||
spawnSet.set("x", x);
|
||||
spawnSet.set("y", y);
|
||||
spawnSet.set("z", z);
|
||||
spawnSet.set("heading", heading);
|
||||
spawnSet.set("delay", delay);
|
||||
spawnSet.set("respawn", respawn);
|
||||
spawnSet.set("respawnRandom", respawnRandom);
|
||||
if (allowRandomWalk == null)
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!_allowRandomWalk);
|
||||
spawnSet.set("allowRandomWalk", !_allowRandomWalk);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
}
|
||||
if (spawnGroup.equals("general"))
|
||||
{
|
||||
final L2Npc spawned = spawnDat.doSpawn();
|
||||
if ((delay >= 0) && (spawned instanceof L2Attackable))
|
||||
{
|
||||
((L2Attackable) spawned).setOnKillDelay(delay);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
manualSpawn.add(spawnDat);
|
||||
spawnSet.set("allowRandomWalk", !allowRandomWalk);
|
||||
}
|
||||
_spawnTemplates.add(spawnSet);
|
||||
}
|
||||
}
|
||||
|
||||
if (!manualSpawn.isEmpty())
|
||||
{
|
||||
_manualSpawn.put(spawnGroup, manualSpawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -674,7 +683,7 @@ public final class Instance
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Error parsing instance xml: " + e.getMessage(), e);
|
||||
LOGGER.log(Level.WARNING, "Error parsing instance xml: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.entity.Instance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
|
@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2OlympiadStadiumZone;
|
||||
@ -45,9 +46,33 @@ public class OlympiadGameManager implements Runnable
|
||||
|
||||
_tasks = new OlympiadGameTask[zones.size()];
|
||||
int i = 0;
|
||||
int instanceId = 0;
|
||||
for (L2OlympiadStadiumZone zone : zones)
|
||||
{
|
||||
_tasks[i++] = new OlympiadGameTask(zone);
|
||||
switch (zone.getName())
|
||||
{
|
||||
case "Grassy Arena":
|
||||
{
|
||||
instanceId = InstanceManager.getInstance().createDynamicInstance("OlympiadGrassyArena.xml");
|
||||
break;
|
||||
}
|
||||
case "Three Bridges Arena":
|
||||
{
|
||||
instanceId = InstanceManager.getInstance().createDynamicInstance("OlympiadThreeBridgesArena.xml");
|
||||
break;
|
||||
}
|
||||
case "Heros's Vestiges Arena":
|
||||
{
|
||||
instanceId = InstanceManager.getInstance().createDynamicInstance("OlympiadHerossVestigesArena.xml");
|
||||
break;
|
||||
}
|
||||
case "Orbis Arena":
|
||||
{
|
||||
instanceId = InstanceManager.getInstance().createDynamicInstance("OlympiadOrbisArena.xml");
|
||||
break;
|
||||
}
|
||||
}
|
||||
_tasks[i++] = new OlympiadGameTask(zone, instanceId);
|
||||
}
|
||||
|
||||
_log.log(Level.INFO, "Olympiad System: Loaded " + _tasks.length + " stadiums.");
|
||||
|
@ -103,9 +103,10 @@ public final class OlympiadGameTask implements Runnable
|
||||
IDLE
|
||||
}
|
||||
|
||||
public OlympiadGameTask(L2OlympiadStadiumZone zone)
|
||||
public OlympiadGameTask(L2OlympiadStadiumZone zone, int instanceId)
|
||||
{
|
||||
_zone = zone;
|
||||
_zone.setInstanceId(instanceId);
|
||||
zone.registerTask(this);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -50,8 +49,6 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
/** Parameters to affect specific characters */
|
||||
private boolean _checkAffected = false;
|
||||
private String _name = null;
|
||||
private int _instanceId = -1;
|
||||
private String _instanceTemplate = "";
|
||||
private int _minLvl;
|
||||
private int _maxLvl;
|
||||
private int[] _race;
|
||||
@ -61,6 +58,7 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
private boolean _allowStore;
|
||||
protected boolean _enabled;
|
||||
private AbstractZoneSettings _settings;
|
||||
private int _instanceId = -1;
|
||||
|
||||
protected L2ZoneType(int id)
|
||||
{
|
||||
@ -100,15 +98,6 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
{
|
||||
_name = value;
|
||||
}
|
||||
else if (name.equals("instanceId"))
|
||||
{
|
||||
_instanceId = Integer.parseInt(value);
|
||||
}
|
||||
else if (name.equals("instanceTemplate"))
|
||||
{
|
||||
_instanceTemplate = value;
|
||||
_instanceId = InstanceManager.getInstance().createDynamicInstance(value);
|
||||
}
|
||||
// Minimum level
|
||||
else if (name.equals("affectedLvlMin"))
|
||||
{
|
||||
@ -191,6 +180,10 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
{
|
||||
_enabled = Boolean.parseBoolean(value);
|
||||
}
|
||||
else if (name.equals("instanceId"))
|
||||
{
|
||||
_instanceId = Integer.parseInt(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Unknown parameter - " + name + " in zone: " + getId());
|
||||
@ -327,15 +320,6 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
return _instanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns zone instanceTemplate
|
||||
* @return
|
||||
*/
|
||||
public String getInstanceTemplate()
|
||||
{
|
||||
return _instanceTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given coordinates are within zone's plane
|
||||
* @param x
|
||||
|
Reference in New Issue
Block a user