Exemplo n.º 1
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="obj"></param>
 public ObjTemplate(ObjTemplate obj)
 {
     this._affected = new List<Affect>(obj._affected);
     this._affectedBy = new int[obj._affectedBy.Length];
     obj._affectedBy.CopyTo(_affectedBy, 0);
     this._antiFlags = new int[obj._antiFlags.Length];
     obj._antiFlags.CopyTo(_antiFlags, 0);
     this._area = obj._area;
     this._condition = obj._condition;
     this._cost = obj._cost;
     this._count = 0;
     this._craftsmanshipLevel = obj._craftsmanshipLevel;
     this._customActions = new List<CustomAction>(obj._customActions);
     this._extraDescriptions = new List<ExtendedDescription>(obj._extraDescriptions);
     this._extraFlags = new int[obj._extraFlags.Length];
     obj._extraFlags.CopyTo(_extraFlags, 0);
     this._fullDescription = obj._fullDescription;
     this._indexNumber = obj._area.HighObjIndexNumber + 1;
     this._itemType = obj._itemType;
     this._level = obj._level;
     this._material = obj._material;
     this._maxNumber = obj._maxNumber;
     this._name = obj._name;
     this._scarcity = obj._scarcity;
     this._shortDescription = obj._shortDescription;
     this._size = obj._size;
     this._specFun = new List<ObjSpecial>(obj._specFun);
     this._specFunName = obj._specFunName;
     this._spellEffects = new List<SpellEntry>(obj._spellEffects);
     this._trap = obj._trap;
     this._values = new int[obj._values.Length];
     obj._values.CopyTo(_values, 0);
     this._volume = obj._volume;
     this._wearFlags = new int[obj._wearFlags.Length];
     obj._wearFlags.CopyTo(_wearFlags, 0);
     this._weight = obj._weight;
     ++_numObjIndex;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an object and initializes it to the parent object values.
        /// </summary>
        /// <param name="indexData"></param>
        public Object( ObjTemplate indexData )
        {
            if( indexData == null )
            {
                Log.Error( "Object.Object(ObjIndex *) called with null ObjIndex.", 0 );
                return;
            }

            ++_numObjects;
            _objIndexNumber = indexData.IndexNumber;
            _objIndexData = indexData;
            _wearLocation = ObjTemplate.WearLocation.none;
            _flyLevel = 0;
            _level = 1;
            _timer = -1;
            _createdBy = null;
            _extraDescription = indexData.ExtraDescriptions;
            _name = indexData.Name;
            _shortDescription = indexData.ShortDescription;
            _fullDescription = indexData.FullDescription;
            _specFun = indexData.SpecFun;
            _itemType = indexData.ItemType;
            int count;
            for( count = 0; count < Limits.NUM_ITEM_EXTRA_VECTORS; ++count )
                _extraFlags[ count ] = indexData.ExtraFlags[ count ];
            for( count = 0; count < Limits.NUM_AFFECT_VECTORS; ++count )
            {
                _affectedBy[ count ] = indexData.AffectedBy[ count ];
            }
            _wearFlags = indexData.WearFlags;
            _antiFlags = indexData.UseFlags;
            _material = indexData.Material;
            _size = indexData.Size;
            _volume = indexData.Volume;
            _craftsmanship = indexData.CraftsmanshipLevel;
            for( count = 0; count < 8; ++count )
                _values[ count ] = indexData.Values[ count ];
            _weight = indexData.Weight;
            _cost = indexData.Cost;
            _condition = indexData.Condition;
            _trap = indexData.Trap;

            // Create vehicle data for vehicles that are created.  The
            // bulk of the data is stored in the object - Xangis
            if( _itemType == ObjTemplate.ObjectType.vehicle || _itemType == ObjTemplate.ObjectType.ship )
            {
                Vehicle vehicle = new Vehicle();
                if( _itemType == ObjTemplate.ObjectType.ship )
                    vehicle.Type = Vehicle.VehicleType.ship_any_water;
                else
                    vehicle.Type = Vehicle.VehicleType.flat_land;
                // need to create virtual rooms for the rest of the data
                vehicle.HullPoints = _values[ 5 ];
                vehicle.FlyLevel = 0;
                vehicle.Direction = 0;
                vehicle.Speed = 0;
                vehicle.Occupants = 0;
                vehicle.MovementTimer = 0;
                vehicle.MovementDelay = 0;
                vehicle.MovementPointer = 0;
                vehicle.MovementScript = String.Empty;
                vehicle.ParentObject = this;
                vehicle.EntryRoomTemplateNumber = _values[ 1 ];
                vehicle.ControlPanelRoomTemplateNumber = _values[ 2 ];
            }

            ++indexData.QuantityLoaded;
            --indexData.Scarcity;

            Database.ObjectList.Add( this );

            return;
        }