public BaseRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent) { ReadString(xml["rune"], "name", ref m_RuneName, false); bool logoutDelayActive = true; ReadBoolean(xml["logoutDelay"], "active", ref logoutDelayActive, false); m_NoLogoutDelay = !logoutDelayActive; XmlElement spawning = xml["spawning"]; if (spawning != null) { ReadBoolean(spawning, "excludeFromParent", ref m_ExcludeFromParentSpawns, false); SpawnZLevel zLevel = SpawnZLevel.Lowest; ReadEnum(spawning, "zLevel", ref zLevel, false); m_SpawnZLevel = zLevel; List <SpawnEntry> list = new List <SpawnEntry>(); foreach (XmlNode node in spawning.ChildNodes) { XmlElement el = node as XmlElement; if (el != null) { SpawnDefinition def = SpawnDefinition.GetSpawnDefinition(el); if (def == null) { continue; } int id = 0; if (!ReadInt32(el, "id", ref id, true)) { continue; } int amount = 0; if (!ReadInt32(el, "amount", ref amount, true)) { continue; } TimeSpan minSpawnTime = SpawnEntry.DefaultMinSpawnTime; ReadTimeSpan(el, "minSpawnTime", ref minSpawnTime, false); TimeSpan maxSpawnTime = SpawnEntry.DefaultMaxSpawnTime; ReadTimeSpan(el, "maxSpawnTime", ref maxSpawnTime, false); Point3D home = Point3D.Zero; int range = 0; XmlElement homeEl = el["home"]; if (ReadPoint3D(homeEl, map, ref home, false)) { ReadInt32(homeEl, "range", ref range, false); } Direction dir = SpawnEntry.InvalidDirection; ReadEnum(el["direction"], "value", ref dir, false); SpawnEntry entry = new SpawnEntry(id, this, home, range, dir, def, amount, minSpawnTime, maxSpawnTime); list.Add(entry); } } if (list.Count > 0) { m_Spawns = list.ToArray(); } } }
public BaseRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent ) { ReadString( xml["rune"], "name", ref m_RuneName, false ); bool logoutDelayActive = true; ReadBoolean( xml["logoutDelay"], "active", ref logoutDelayActive, false ); m_NoLogoutDelay = !logoutDelayActive; XmlElement spawning = xml["spawning"]; if ( spawning != null ) { ReadBoolean( spawning, "excludeFromParent", ref m_ExcludeFromParentSpawns, false ); SpawnZLevel zLevel = SpawnZLevel.Lowest; ReadEnum(spawning, "zLevel", ref zLevel, false); m_SpawnZLevel = zLevel; List<SpawnEntry> list = new List<SpawnEntry>(); foreach ( XmlNode node in spawning.ChildNodes ) { XmlElement el = node as XmlElement; if ( el != null ) { SpawnDefinition def = SpawnDefinition.GetSpawnDefinition( el ); if ( def == null ) continue; int id = 0; if ( !ReadInt32( el, "id", ref id, true ) ) continue; int amount = 0; if ( !ReadInt32( el, "amount", ref amount, true ) ) continue; TimeSpan minSpawnTime = SpawnEntry.DefaultMinSpawnTime; ReadTimeSpan( el, "minSpawnTime", ref minSpawnTime, false ); TimeSpan maxSpawnTime = SpawnEntry.DefaultMaxSpawnTime; ReadTimeSpan( el, "maxSpawnTime", ref maxSpawnTime, false ); Point3D home = Point3D.Zero; int range = 0; XmlElement homeEl = el["home"]; if ( ReadPoint3D( homeEl, map, ref home, false ) ) ReadInt32( homeEl, "range", ref range, false ); Direction dir = SpawnEntry.InvalidDirection; ReadEnum(el["direction"], "value", ref dir, false); SpawnEntry entry = new SpawnEntry( id, this, home, range, dir, def, amount, minSpawnTime, maxSpawnTime ); list.Add( entry ); } } if ( list.Count > 0 ) { m_Spawns = list.ToArray(); } } }