Exemplo n.º 1
0
        public static void MoveItem(object item, object destination, int amount = -1)
        {
            int itemSerial = AliasCommands.ResolveSerial(item);

            if (itemSerial == 0)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return;
            }

            Item itemObj = Engine.Items.GetItem(itemSerial);

            if (itemObj == null)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return;
            }

            if (amount == -1)
            {
                amount = itemObj.Count;
            }

            int containerSerial = AliasCommands.ResolveSerial(destination);

            if (containerSerial == 0)
            {
                //TODO
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return;
            }

            UOC.DragDropAsync(itemSerial, amount, containerSerial).Wait();
        }
Exemplo n.º 2
0
        public static void Feed(object obj, int graphic, int amount = 1, int hue = -1)
        {
            int serial = AliasCommands.ResolveSerial(obj);

            if (serial == 0)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return;
            }

            if (Engine.Player?.Backpack == null)
            {
                UOC.SystemMessage(Strings.Error__Cannot_find_player_backpack);
                return;
            }

            Item foodItem =
                Engine.Player.Backpack?.Container.SelectEntity(i => i.ID == graphic && (hue == -1 || i.Hue == hue));

            if (foodItem == null)
            {
                UOC.SystemMessage(Strings.Cannot_find_item___);
                return;
            }

            UOC.DragDropAsync(foodItem.Serial, amount, serial).Wait();
        }
Exemplo n.º 3
0
        public static void ClearHands(string hand = "both")
        {
            hand = hand.ToLower();
            List <Layer> unequipLayers = new List <Layer>();

            switch (hand)
            {
            case "left":
                unequipLayers.Add(Layer.OneHanded);
                break;

            case "right":
                unequipLayers.Add(Layer.TwoHanded);
                break;

            case "both":
                unequipLayers.Add(Layer.OneHanded);
                unequipLayers.Add(Layer.TwoHanded);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(hand));
            }

            PlayerMobile player = Engine.Player;

            List <int> serials = unequipLayers.Select(unequipLayer => Engine.Player.GetLayer(unequipLayer))
                                 .Where(serial => serial != 0).ToList();

            foreach (int serial in serials)
            {
                UOC.DragDropAsync(serial, 1, player.Backpack?.Serial ?? 0).Wait();
                Thread.Sleep(Options.CurrentOptions.ActionDelayMS);
            }
        }