Exemple #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            _Addon               = (MovableAddon)reader.ReadItem();
            AddonHue             = reader.ReadInt();
            ExhaustPowerTimeSpan = reader.ReadTimeSpan();
        }
Exemple #2
0
        public virtual void RemoveAddon()
        {
            ExhaustPowerTimeSpan = _Addon.ExhaustPowerTimeSpan;

            if (!Addon.Deleted)
            {
                Addon.Delete();
            }


            Addon = null;

            InvalidateProperties();
        }
Exemple #3
0
        //note: this is executed after the inherited class creates the movable addon to its liking
        public virtual void FinishCreation(Mobile from, Point3D point)
        {
            //the inherited class should create the addon and then call this method.  If there's a problem, this method will show
            if (_Addon == null)
            {
                from.SendMessage("There was an error generating this addon.  Consult staff!");
                return;
            }

            _Addon.ExhaustPowerTimeSpan = ExhaustPowerTimeSpan;
            point = new Point3D(point.X, point.Y, _Addon.GetHighestZ(point, from.Map));

            bool trashaddon = false;


            if (!from.InRange(point, 10))
            {
                from.SendMessage("You are out of range.");
                trashaddon = true;
            }
            else if (!CanCreateAddon(from))
            {
                from.SendMessage("You can no longer do that");
                trashaddon = true;
            }
            else if (!_Addon.CanCreateAt(point, from.Map))
            {
                from.SendMessage("That is not a valid location.");
                trashaddon = true;
            }
            else if (!_Addon.CanMoveTo(point, from.Map))
            {
                from.SendMessage("That cannot fit there.  Please try again.");
                trashaddon = true;
            }
            else
            {
                _Addon.MoveTo(point, Map, true);
                from.SendGump(new ConfirmAddonPlaceGump(this, from));
            }

            if (trashaddon)
            {
                _Addon.Delete();
                _Addon = null;
            }
        }
Exemple #4
0
        //finally, this occurs after the user has confirmed that they wish to create their movable addon where they selected
        public virtual void ConfirmCreation(Mobile from, bool confirmed)
        {
            if (!confirmed)
            {
                if (_Addon != null)
                {
                    from.SendMessage("Placement cancelled");
                    _Addon.Delete();
                    _Addon = null;
                }
            }
            else
            {
                _Addon.Key = this;


                AddonHue = _Addon.Hue;
                from.SendMessage(_PlaceConfirmMessage);
                InvalidateProperties();
            }
        }
Exemple #5
0
        public MovableAddonControlGump(MovableAddon addon, Mobile owner) : base(100, 100)
        {
            _Owner = owner;
            _Addon = addon;

            if (_Owner == null || _Addon == null)
            {
                return;
            }

            _Owner.CloseGump(typeof(MovableAddonControlGump));

            AddPage(0);
            AddImage(0, 0, 0x24F4);

            AddDirectionControls(_X + 30, _Y + 5);

            AddSpeedControls(_X + 150, _Y + 20);

            if (_Addon.PowerResourceType != null)
            {
                AddPowerRefillControls(_X + 100, _Y += 105);
            }
        }
Exemple #6
0
 public FlyingCarpetControlGump(MovableAddon addon, Mobile owner) : base(addon, owner)
 {
 }
Exemple #7
0
 public AddResourceTarget(MovableAddon addon) : base(-1, false, TargetFlags.None)
 {
     _Addon = addon;
 }