protected void GetBestName()
        {
            // Item name

            if (Item.Name != null && Item.Name != "")
            {
                _Name = Item.Name;
            }
            else
            {
                _Name = CliLoc.GetName(Item);
            }
        }
예제 #2
0
        protected bool Purchase(Type type, int amount)
        {
            Item resource = _Owner.Backpack.FindItemByType(type, true);

            if (resource == null || resource.Amount < amount)
            {
                _Owner.SendMessage("You need more " + CliLoc.GetName(type) + ".");
                return(false);
            }

            resource.Consume(amount);
            return(true);
        }
예제 #3
0
        public void GenerateContentsName()
        {
            _Contents = "";

            for (int i = 0; i < _Entries.Length; i++)
            {
                _Contents += CliLoc.GetName(_Entries[i].Details.Type);

                if (i < _Entries.Length - 1)
                {
                    _Contents += ", ";
                }
            }
        }
예제 #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted.GetType() != _Addon.PowerResourceType)
                {
                    from.SendMessage("That cannot be used for power.  You need " + CliLoc.GetName(_Addon.PowerResourceType) + ".");
                    return;
                }

                if (!((Item)targeted).IsChildOf(from.Backpack))
                {
                    from.SendMessage("That must be in your backpack");
                    return;
                }

                _Addon.Refuel((Item)targeted);
            }
예제 #5
0
        public override void AddNameProperties(ObjectPropertyList list)
        {
            base.AddNameProperties(list);

            if (_Addon.PowerResourceType != null)
            {
                TimeSpan powerleft = _Addon.ExhaustPowerTimeSpan;

                list.Add(1076228, "{0}\t{1}", "Power Source:", CliLoc.GetName(_Addon.PowerResourceType));

                if (powerleft > TimeSpan.Zero)
                {
                    list.Add(1060663, "Time left until power expires\t{0}", TimeLeft(powerleft));
                }
                else
                {
                    list.Add(1070722, "Out of power");
                }
            }
        }
예제 #6
0
        public FlyingCarpetConfigGump(MovableAddonKey key, Mobile owner) : base(key, owner)
        {
            if (_Owner == null || _Key == null)
            {
                return;
            }

            _Lamp = (FlyingCarpetMagicLamp)key;

            AddLabel(_X, _Y, 88, "Flying Carpet Configuration");

            AddLabel(_X, _Y += 50, 1152, "Current Carpet Layout");

            AddLabel(_X, _Y += 50, 1152, "Length: " + _Lamp.CarpetLength.ToString());
            AddLabel(_X + 150, _Y, 1152, "Width: " + _Lamp.CarpetWidth.ToString());
            AddLabel(_X, _Y += 40, 1152, "Design: ");

            AddItem(_X + 100, _Y, FlyingCarpetComponent.CarpetIDs[(int)_Lamp.CarpetType][0][0], _Key.AddonHue);

            AddLabel(_X, _Y += 50, 1152, "Available Modifications/Upgrades:");

            AddLabel(_X + 10, _Y += 20, 1152, String.Format("(cost requirement: {0})", CliLoc.GetName(_Lamp.ModifyResourceType)));


            AddLabel(_X, _Y += 50, 1152, "Modification");
            AddLabel(_X + 200, _Y, 1152, "Cost");

            AddLabel(_X, _Y += 30, 1152, "Change carpet design");
            AddLabel(_X + 200, _Y, 1152, DesignCost.ToString());

            if (_Lamp.Addon == null)
            {
                AddButton(_X + 250, _Y, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            }

            if (_Lamp.CarpetLength < FlyingCarpet.MAX_LENGTH)
            {
                AddLabel(_X, _Y += 20, 1152, "Increase length");
                AddLabel(_X + 200, _Y, 1152, LengthUpgradeCost.ToString());

                if (_Lamp.Addon == null)
                {
                    AddButton(_X + 250, _Y, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
                }
            }

            if (_Lamp.CarpetWidth < FlyingCarpet.MAX_WIDTH)
            {
                AddLabel(_X, _Y += 20, 1152, "Increase width");
                AddLabel(_X + 200, _Y, 1152, WidthUpgradeCost.ToString());

                if (_Lamp.Addon == null)
                {
                    AddButton(_X + 250, _Y, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
                }
            }

            if (_Lamp.CarpetLength > 3)
            {
                AddLabel(_X, _Y += 20, 1152, "Decrease length");
                AddLabel(_X + 200, _Y, 1152, LengthDowngradeCost.ToString());

                if (_Lamp.Addon == null)
                {
                    AddButton(_X + 250, _Y, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
                }
            }

            if (_Lamp.CarpetWidth > 3)
            {
                AddLabel(_X, _Y += 20, 1152, "Decrease width");
                AddLabel(_X + 200, _Y, 1152, WidthDowngradeCost.ToString());

                if (_Lamp.Addon == null)
                {
                    AddButton(_X + 250, _Y, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
                }
            }

            if (_Lamp.Addon != null)
            {
                AddLabel(_X, _Y += 30, 88, "To make upgrades, store your carpet");
            }
        }