SpawnInfo spawnDat = null;
int removedItemId = 0, removedItemCount = 0, giveItemId = 0, givedItemCount = 0, requiredQuestId = 0;
int maxChannels = 20;
boolean removedItemNecessity = false;
boolean setReuseUponEntry = true;
StatsSet params = new StatsSet();
List<InstantZone.SpawnInfo> spawns = new ArrayList<>();
IntObjectMap<InstantZone.DoorInfo> doors = Containers.emptyIntObjectMap();
Map<String, InstantZone.ZoneInfo> zones = Collections.emptyMap();
Map<String, InstantZone.SpawnInfo2> spawns2 = Collections.emptyMap();
instanceId = Integer.parseInt(element.attributeValue("id"));
name = element.attributeValue("name");
String n = element.attributeValue("timelimit");
if (n != null)
{
timelimit = Integer.parseInt(n);
}
n = element.attributeValue("collapseIfEmpty");
collapseIfEmpty = Integer.parseInt(n);
n = element.attributeValue("maxChannels");
maxChannels = Integer.parseInt(n);
n = element.attributeValue("dispelBuffs");
dispelBuffs = (n != null) && Boolean.parseBoolean(n);
int minLevel = 0, maxLevel = 0, minParty = 1, maxParty = 7;
List<Location> teleportLocs = Collections.emptyList();
Location ret = null;
for (Iterator<Element> subIterator = element.elementIterator(); subIterator.hasNext();)
{
Element subElement = subIterator.next();
if ("level".equalsIgnoreCase(subElement.getName()))
{
minLevel = Integer.parseInt(subElement.attributeValue("min"));
maxLevel = Integer.parseInt(subElement.attributeValue("max"));
}
else if ("collapse".equalsIgnoreCase(subElement.getName()))
{
onPartyDismiss = Boolean.parseBoolean(subElement.attributeValue("on-party-dismiss"));
timer = Integer.parseInt(subElement.attributeValue("timer"));
}
else if ("party".equalsIgnoreCase(subElement.getName()))
{
minParty = Integer.parseInt(subElement.attributeValue("min"));
maxParty = Integer.parseInt(subElement.attributeValue("max"));
}
else if ("return".equalsIgnoreCase(subElement.getName()))
{
ret = Location.parseLoc(subElement.attributeValue("loc"));
}
else if ("teleport".equalsIgnoreCase(subElement.getName()))
{
if (teleportLocs.isEmpty())
{
teleportLocs = new ArrayList<>(1);
}
teleportLocs.add(Location.parseLoc(subElement.attributeValue("loc")));
}
else if ("remove".equalsIgnoreCase(subElement.getName()))
{
removedItemId = Integer.parseInt(subElement.attributeValue("itemId"));
removedItemCount = Integer.parseInt(subElement.attributeValue("count"));
removedItemNecessity = Boolean.parseBoolean(subElement.attributeValue("necessary"));
}
else if ("give".equalsIgnoreCase(subElement.getName()))
{
giveItemId = Integer.parseInt(subElement.attributeValue("itemId"));
givedItemCount = Integer.parseInt(subElement.attributeValue("count"));
}
else if ("quest".equalsIgnoreCase(subElement.getName()))
{
requiredQuestId = Integer.parseInt(subElement.attributeValue("id"));
}
else if ("reuse".equalsIgnoreCase(subElement.getName()))
{
resetReuse = new SchedulingPattern(subElement.attributeValue("resetReuse"));
sharedReuseGroup = Integer.parseInt(subElement.attributeValue("sharedReuseGroup"));
setReuseUponEntry = Boolean.parseBoolean(subElement.attributeValue("setUponEntry"));
}
else if ("geodata".equalsIgnoreCase(subElement.getName()))
{
String[] rxy = subElement.attributeValue("map").split("_");
mapx = Integer.parseInt(rxy[0]);
mapy = Integer.parseInt(rxy[1]);
}
else if ("doors".equalsIgnoreCase(subElement.getName()))
{
for (Element e : subElement.elements())
{
if (doors.isEmpty())
{
doors = new HashIntObjectMap<>();
}
boolean opened = (e.attributeValue("opened") != null) && Boolean.parseBoolean(e.attributeValue("opened"));
boolean invul = (e.attributeValue("invul") == null) || Boolean.parseBoolean(e.attributeValue("invul"));
DoorTemplate template = DoorHolder.getInstance().getTemplate(Integer.parseInt(e.attributeValue("id")));
doors.put(template.getNpcId(), new InstantZone.DoorInfo(template, opened, invul));
}
}
else if ("zones".equalsIgnoreCase(subElement.getName()))
{
for (Element e : subElement.elements())
{
if (zones.isEmpty())
{
zones = new HashMap<>();
}
boolean active = (e.attributeValue("active") != null) && Boolean.parseBoolean(e.attributeValue("active"));
ZoneTemplate template = ZoneHolder.getInstance().getTemplate(e.attributeValue("name"));
if (template == null)
{
error("Zone: " + e.attributeValue("name") + " not found; file: " + getCurrentFileName());
continue;
}
zones.put(template.getName(), new InstantZone.ZoneInfo(template, active));
}
}
else if ("add_parameters".equalsIgnoreCase(subElement.getName()))
{
for (Element e : subElement.elements())
{
if ("param".equalsIgnoreCase(e.getName()))
{
params.set(e.attributeValue("name"), e.attributeValue("value"));
}
}
}
else if ("spawns".equalsIgnoreCase(subElement.getName()))
{