Exemplo n.º 1
0
        public AddonToolComponent(CraftSystem system, int inactiveid, int activeid, int cliloc, int uses, CraftAddon addon)
            : base(0, inactiveid)
        {
            _CraftSystem = system;
            _LabelNumber = cliloc;
            Addon        = addon;
            Movable      = false;

            InactiveID = inactiveid;
            ActiveID   = activeid;

            UsesRemaining = uses;
        }
Exemplo n.º 2
0
            public override bool OnDragDrop(Mobile from, Item dropped)
            {
                BaseHouse  house = BaseHouse.FindHouseAt(this);
                CraftAddon addon = Addon as CraftAddon;

                if (house != null && addon != null && house.HasSecureAccess(from, addon.Level) && dropped is ITool && !(dropped is BaseRunicTool))
                {
                    var tool = dropped as ITool;

                    if (addon != null && tool.CraftSystem == addon.CraftSystem)
                    {
                        AddonToolComponent comp = addon.Tools.FirstOrDefault(t => t != null);

                        if (comp == null)
                        {
                            return(false);
                        }

                        if (comp.UsesRemaining >= comp.MaxUses)
                        {
                            from.SendMessage("That is already at its maximum charges.");
                            return(false);
                        }
                        else
                        {
                            int toadd = Math.Min(tool.UsesRemaining, comp.MaxUses - comp.UsesRemaining);

                            comp.UsesRemaining += toadd;
                            tool.UsesRemaining -= toadd;

                            if (tool.UsesRemaining <= 0 && !tool.Deleted)
                            {
                                tool.Delete();
                            }

                            Effects.PlaySound(this.Location, this.Map, 0x42);

                            return(false);
                        }
                    }
                }

                return(false);
            }
Exemplo n.º 3
0
            public override bool OnDragDrop(Mobile from, Item dropped)
            {
                BaseHouse  house = BaseHouse.FindHouseAt(this);
                CraftAddon addon = Addon as CraftAddon;

                if (house != null && addon != null && house.HasSecureAccess(from, addon.Level))
                {
                    if (dropped is ITool && !(dropped is BaseRunicTool))
                    {
                        ITool tool = dropped as ITool;

                        if (tool.CraftSystem == addon.CraftSystem)
                        {
                            AddonToolComponent comp = addon.Tools.FirstOrDefault(t => t != null);

                            if (comp == null)
                            {
                                return(false);
                            }

                            if (comp.UsesRemaining >= comp.MaxUses)
                            {
                                from.SendLocalizedMessage(1155740); // Adding this to the power tool would put it over the max number of charges the tool can hold.
                                return(false);
                            }
                            else
                            {
                                int toadd = Math.Min(tool.UsesRemaining, comp.MaxUses - comp.UsesRemaining);

                                comp.UsesRemaining += toadd;
                                tool.UsesRemaining -= toadd;

                                if (tool.UsesRemaining <= 0 && !tool.Deleted)
                                {
                                    tool.Delete();
                                }

                                from.SendLocalizedMessage(1155741); // Charges have been added to the power tool.

                                Effects.PlaySound(Location, Map, 0x42);

                                return(false);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1074836); // The container cannot hold that type of object.
                            return(false);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1074836); // The container cannot hold that type of object.
                        return(false);
                    }
                }
                else
                {
                    SendLocalizedMessageTo(from, 1061637); // You are not allowed to access this.
                    return(false);
                }
            }
Exemplo n.º 4
0
 public AddonToolComponent(CraftSystem system, int inactiveid, int activeid, int cliloc, int uses, CraftAddon addon)
     : this(system, inactiveid, activeid, 0, 0, cliloc, uses, addon)
 {
 }