Ejemplo n.º 1
0
		public static SpawnMobile Get( Type type )
		{
			SpawnMobile sm = (SpawnMobile) m_Table[type];

			if ( sm == null )
			{
				sm = new SpawnMobile( type );
				m_Table[type] = sm;
			}

			return sm;
		}
Ejemplo n.º 2
0
        public static SpawnDefinition GetSpawnDefinition(XmlElement xml)
        {
            switch (xml.Name)
            {
            case "object":
            {
                Type type = null;
                if (!Region.ReadType(xml, "type", ref type))
                {
                    return(null);
                }

                if (typeof(Mobile).IsAssignableFrom(type))
                {
                    return(SpawnMobile.Get(type));
                }
                else if (typeof(Item).IsAssignableFrom(type))
                {
                    return(SpawnItem.Get(type));
                }
                else
                {
                    Console.WriteLine("Invalid type '{0}' in a SpawnDefinition", type.FullName);
                    return(null);
                }
            }

            case "group":
            {
                string group = null;
                if (!Region.ReadString(xml, "name", ref group))
                {
                    return(null);
                }

                SpawnDefinition def = (SpawnDefinition)SpawnGroup.Table[group];

                if (def == null)
                {
                    Console.WriteLine("Could not find group '{0}' in a SpawnDefinition", group);
                    return(null);
                }
                else
                {
                    return(def);
                }
            }

            /*case "treasureChest":
             * {
             *      int itemID = 0xE43;
             *      Region.ReadInt32( xml, "itemID", ref itemID, false );
             *
             *      BaseTreasureChest.TreasureLevel level = BaseTreasureChest.TreasureLevel.Level2;
             *
             *      Region.ReadEnum( xml, "level", ref level, false );
             *
             *      return new SpawnTreasureChest( itemID, level );
             * }*/
            default:
            {
                return(null);
            }
            }
        }