Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Send a number items to a recipient

Featured Replies

Hi 

I want Send a number items to a recipient with code。How can i set the quantity? 

Like this :SendItems("recipient", "sub","item" ,quantity)

// Mail Items *custom script* - By Reapler


    public static int InteractItems(List<string> itemNames, int interactions = int.MaxValue)
    {
        if (!itemNames.Any())
            return -1;
        var execute = 
            "local counter = 0; " +
            "local leftStacks = 0; " +
            "for b=0,4 do " +
            "if GetBagName(b) then " +
            "for s=1, GetContainerNumSlots(b) do " +
            "local itemLink = GetContainerItemLink(b, s) " +
            "if itemLink then " +
            "local _, stackCount = GetContainerItemInfo(b, s)\t" +
            "if string.find(itemLink, \""+ itemNames.FirstOrDefault() + "\") ";
        if (itemNames.Count > 1)
        {
            execute = itemNames.Where(obj => itemNames.FirstOrDefault() != obj).Aggregate(execute, (current, obj) => current + "or string.find(itemLink, \"" + obj + "\") ");
        }
        execute = execute + 
                  "then " +
                  "if (counter < "+interactions+") then " +
                  "UseContainerItem(b, s); " +
                  "counter = counter + 1; " +
                  "else " +
                  "leftStacks = leftStacks + 1;" +
                  "end " +
                  "\tend\tend\tend end end return leftStacks;";
        return Lua.LuaDoString<int>(execute);
    }

    /// <summary>
    /// Sends a mail to a recipient.
    /// </summary>
    /// <param name="recipient">The recipient.</param>
    /// <param name="subject">The subject.</param>
    /// <param name="itemNames">The items to send as names.</param>
    /// <returns>true if successful ; false if no mailbox available or stacks are left.</returns>
    public bool SendItems(string recipient, string subject, List<string> itemNames)
    {
        var mailBox = ObjectManager.GetObjectWoWGameObject().FirstOrDefault(i => i.IsMailbox && i.GetDistance <= 5);
        if (mailBox == null || string.IsNullOrWhiteSpace(recipient))
            return false;
        if (subject.Length == 0)
            subject = "-";
        if (mailBox)
        {
            const int delayMs = 800;
            var timeOut = DateTime.Now.AddSeconds(40);
            Interact.InteractGameObject(mailBox.GetBaseAddress);
            Thread.Sleep(delayMs);
            Lua.LuaDoString("RunMacroText('/click MailFrameTab2');");
            Thread.Sleep(delayMs);

            var leftStack = InteractItems(itemNames, 12);
            Thread.Sleep(delayMs);
            Lua.LuaDoString($"SendMail(\"{recipient}\",\"{subject}\",\" \");");
            Thread.Sleep(delayMs*3);

            while (leftStack != 0 && DateTime.Now < timeOut)
            {
                leftStack = InteractItems(itemNames, 12);
                Thread.Sleep(delayMs);
                Lua.LuaDoString($"SendMail(\"{recipient}\",\"{subject}\",\" \");");
                Thread.Sleep(delayMs*3);
            }

            Lua.LuaDoString("CloseMail();");
            if (leftStack != 0)
                return false;
        }
        return true;
    }
	
	
	
	
	// Usage: runcode

        SendItems("Reapler", "items for you", 
            new List<string>
            {
                "Super Healing Potion",
                "Heavy Netherweave Bandage",
                "Super Mana Potion",
            });

 

  • Author

Thanks ! Smokie

I give an example:

 I have 100  light leather ,I need to send 28 light leather.not all.

I have many bots to train Leatherworking,I need send leather to  them. If i can't set the number of leather,mabe all leather will send to one of bot. 

  • Author

I have many bot to train Leatherworking,I need send leather to  them. If i can't set the number of leather,mabe all leather will send to one of bot. 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.