What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Open mailbox

Raigar Amarthalion

New Member
Joined
Apr 29, 2015
Messages
45
Reaction score
0
The following code no longer open the mailbox
Is was working in previous versions, so I guess there was a change undetected by the staff

RequestMailList();
Thread.Sleep(1000);
foreach (var mail in getMails())
{
mail.OpenMail();
}

Can you take a look ?

Regards
 
in addition to previous post :
if (mail.attachments > 0)
{
Log("Attachements found " + mail.attachments);
foreach (var item in mail.getItems())
{
Log("item found");
if (!mail.ReceiveItemFromMail(item)) return false;
}
Log("attachments handled");
}

This code give the following output :
attachments found 2
attachments handled

the mail.getItems() method no longer return items even when there are attachments (was working in previous version)
 
you must first open the mail to get the data defining the attachments, using

mail.OpenMail(); then wait a bit until the items are actually here
 
the same would also work if you open the mail yourself in the client before letting the plugin go through it. OpenMail is the same action as opening a mail in game, it actually download the content of the mail including the items.
 
As you can see in the first post, I already use the OpenMail() method, and I even wait for a little bit more than 1 second : Thread.Sleep(random.Next(500) + 1000);
I believe it is enough, given the time I need to get this data when I'm in game (nearly instant)

The bugs are :
- the code works, but the mailbox window is not shown (so my character is retrieving his mails with the mailbox window close, which is not "natural", and I try to avoid doing things I wouldn't be able to do without AB
- even after a 1000~1500 ms wait after the OpenMail(), the property attachments is greater than 0 but getItems() returns nothing
 
here is a snipet of code to show another weird behavior

Code:
if (!RequestMailList()) return LogError("Could not retrieve mail list"); [COLOR="#008000"]// returns true[/COLOR]
Thread.Sleep(random.Next(500) + 1000);
foreach (var mail in getMails())
{
    if (mail.OpenMail()) [COLOR="#008000"]// returns true[/COLOR]
    {
        Thread.Sleep(random.Next(500) + 1000);
        if (!mail.isSent)
        {
            if (mail.attachments > 0) [COLOR="#008000"]// returns 2 for example[/COLOR]
            {
                foreach (var item in mail.getItems()) [COLOR="#FF0000"]// no iteration, because getItems returns an empty list[/COLOR]
                {
                    if (!mail.ReceiveItemFromMail(item)) return LogError("Could not receive item <{0}> from the mail <{1}>", item.name, mail.title);
                    Thread.Sleep(random.Next(500) + 1000);
                }
            }
        }
    }
    else LogError("Could not open the mail <{0}>", mail.title); [COLOR="#008000"]// not called even once[/COLOR]
    Thread.Sleep(random.Next(500) + 1000);
}

Thread.Sleep(5 * 60 * 1000); // doing stuff, 5 min pause

// same code but results differs
if (!RequestMailList()) return LogError("Could not retrieve mail list");[COLOR="#008000"] // returns true[/COLOR]
Thread.Sleep(random.Next(500) + 1000);
foreach (var mail in getMails())
{
    if (mail.OpenMail()) [COLOR="#FF0000"][B]// returns false if the mail was previously opened[/B], and true if it is a new mail[/COLOR]
    {
        Thread.Sleep(random.Next(500) + 1000);
        if (!mail.isSent)
        {
            if (mail.attachments > 0) [COLOR="#008000"]// returns 2 for example[/COLOR]
            {
                foreach (var item in mail.getItems()) [COLOR="#FF0000"]// no iteration, because getItems returns an empty list[/COLOR]
                {
                    if (!mail.ReceiveItemFromMail(item)) return LogError("Could not receive item <{0}> from the mail <{1}>", item.name, mail.title);
                    Thread.Sleep(random.Next(500) + 1000);
                }
            }
        }
    }
    else LogError("Could not open the mail <{0}> : error = {1}", mail.title, GetLastError().ToString());[COLOR="#FF0000"][B] // each previously opened mail raise a LastError.MailNoBody error[/B][/COLOR]
    Thread.Sleep(random.Next(500) + 1000);
}

I believe this error occurs because RequestMailList() method was called twice, but what if we have to check a second time our mails later on ? :o
 
mmm, im not sure why it would be glitching then
 
Did any archebuddy staff member took a look to this code and tryed it ?
I really believe there was a change in the archeage code, and suspect they plan to ban ppl based on that
 
well i know my bots can still access their mail fine. Altho my code has too much of my stuff intertwined with it i dont plan on posting it. But i did look over the code and for all intent and purpose it should work fine
 
Hi.
I have the same problem too.

Плохо пишу по-английски.
Рабочий код, примерно как у ТС, с некоторых пор перестал нормально отрабатывать.
Если открыть почтовый ящик, то все сразу нормально работает, и письма обрабатываются.
Были случаи, когда многократный запуск такого куска кода в конечном счете позволял обработать письма без совы.
Иногда оставляет несколько писем того же типа необработанными.
Раньше оно работало быстро и четко - это факт.
Если использовать событие onNewMail, то тот же код (но без перебора писем, конечно) работает отлично.
 
that code does work.

PHP:
 RequestMailList();
            foreach (var mail in getMails())
            {
                mail.OpenMail();
                if (!mail.isSent)
                {
                    mail.ReceiveGoldFromMail();
                    foreach (var item in mail.getItems())
                        mail.ReceiveItemFromMail(item);
                    mail.DeleteMail();
                }
                Thread.Sleep(1000);
            }
 
I'm not saying it doesn't work, I'm saying it doesn't open the mailbox in game as it was before
Your char get his mails or delete them, but you don't have anything displayed on the screen, although you previously could see it.
They changed the way the mailbox behave in a patch but AB mail features weren't updated.
 
Back
Top