Esempio n. 1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Object()
 {
     ++_numObjects;
     _createdBy = null;
     _itemType = ObjTemplate.ObjectType.trash;
     _material = 0;
     _size = 0;
     _volume = 0;
     _craftsmanship = 0;
     _wearLocation = 0;
     _weight = 0;
     _cost = 0;
     _level = 1;
     _timer = -1;
     _condition = 100;
     _flyLevel = CharData.FlyLevel.ground;
     int count;
     for( count = 0; count < Limits.NUM_ITEM_EXTRA_VECTORS; ++count )
         _extraFlags[ count ] = 0;
     for (count = 0; count < Limits.NUM_USE_FLAGS_VECTORS; ++count)
         _antiFlags[count] = 0;
     for (count = 0; count < Limits.NUM_WEAR_FLAGS_VECTORS; ++count)
         _wearFlags[count] = 0;
     for (count = 0; count < Limits.NUM_AFFECT_VECTORS; ++count)
         _affectedBy[ count ] = 0;
     for( count = 0; count < 8; ++count )
         _values[ count ] = 0;
 }
Esempio n. 2
0
        private void btnEditSpells_Click(object sender, EventArgs e)
        {
            ObjTemplate.ObjectType type = (ObjTemplate.ObjectType)(Enum.Parse(typeof(ObjTemplate.ObjectType), (String)cbItemType.SelectedItem));

            switch (type)
            {
            default:
                MessageBox.Show("This item type cannot contain spells.");
                break;

            case ObjTemplate.ObjectType.herb:
            case ObjTemplate.ObjectType.pill:
            case ObjTemplate.ObjectType.potion:
            case ObjTemplate.ObjectType.scroll:
            case ObjTemplate.ObjectType.spellbook:
            case ObjTemplate.ObjectType.staff:
            case ObjTemplate.ObjectType.trap:
            case ObjTemplate.ObjectType.wand:
                EditSpells dlg = new EditSpells(_area.Objects[objectList.SelectedIndex].SpellEffects);
                dlg.ShowDialog();
                if (dlg.DialogResult == DialogResult.OK)
                {
                    _area.Objects[objectList.SelectedIndex].SpellEffects = dlg.GetSpellEffects();
                }
                break;
            }
        }
Esempio n. 3
0
 public EditValues(ObjTemplate.ObjectType type, int[] values, String text, Area area)
 {
     _area = area;
     InitializeComponent();
     _values            = values;
     _type              = type;
     lblObjectName.Text = text;
     RefreshWindowContents();
 }
Esempio n. 4
0
 public EditValues(ObjTemplate.ObjectType type, int[] values, String text, Area area)
 {
     _area = area;
     InitializeComponent();
     _values = values;
     _type = type;
     lblObjectName.Text = text;
     RefreshWindowContents();
 }
Esempio n. 5
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;
        }