Jump to content

[fix][8773] Over than 255 mails in box


Guest unik

Recommended Posts

What bug does the patch fix? What features does the patch add?

Fixed the problem of the mails which don't display when itmailbox possess more than 255 messages.

For which repository revision was the patch created?

branch 0.12 - rev 8569

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Didn't find any

Who has been writing this patch? Please include either forum user names or email addresses.

[email protected]

diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp
index 414511f..bbf0246 100644
--- a/src/game/Mail.cpp
+++ b/src/game/Mail.cpp
@@ -577,6 +577,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )

    for(PlayerMails::iterator itr = pl->GetmailBegin(); itr != pl->GetmailEnd(); ++itr)
    {
+        if(mails_count > 254) break;
+        
        // skip deleted or not delivered (deliver delay not expired) mails
        if ((*itr)->state == MAIL_STATE_DELETED || cur_time < (*itr)->deliver_time)
            continue;

Link to comment
Share on other sites

dasblub he breaks when user has more than 254 mails.. so seems like the bug is - if user has 255 mails it won't display anything..

but don't know.. some more information might be helpful..

also mangoscodestyle is:

if (blabla)

break;

having everything on one line makes it easier to read.. ;)

edit: ah sorry now i understand your question.. not sure.. more information about this would be really useful

Link to comment
Share on other sites

yes client is able to display 255 or 254 (not sure..) mails, there is no way to allow more.

On official when you have more than 255 mails in mailbox and you did read all first 255 you will still see envelope near map that you have new mail. You have to delete some mails to be able to see other. There is hidden timer on client, when he sends CSMG_MAIL_LIST or reads mails from latest cache - SMSG_MAIL_LIST_RESPONSE.

Link to comment
Share on other sites

is it even possible, to recive more than 254 letters? i thought that you'd get an error message when you try to do so?

Yes, messages resulting from the auction don't verify if the user has more than 255 mails. However, you shouldn't add this condition on the auction otherwise messages will be lost.

Link to comment
Share on other sites

Yes, messages resulting from the auction don't verify if the user has more than 255 mails. However, you shouldn't add this condition on the auction otherwise messages will be lost.

ok, thanks. i haven't thought at auction mails but only at client mails. yes, then this check is indeed needed.

Link to comment
Share on other sites

Hi!

Fixes all errors on mangos-0.12 at once.

diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp
index 20dc625..fcdde01 100644
--- a/src/game/Mail.cpp
+++ b/src/game/Mail.cpp
@@ -519,7 +519,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
    // client can't work with packets > max int16 value
    const uint32 maxPacketSize = 32767;

-    uint32 mails_count = 0;                                 // real send to client mails amount
+    uint32 mailsCount = 0; // send to client mails amount
+    uint32 realCount = 0; // real mails amount

    WorldPacket data(SMSG_MAIL_LIST_RESULT, (200));         // guess size
    data << uint8(0);                                       // mail's count
@@ -616,10 +617,12 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
            data << (uint32) (item ? item->GetUInt32Value(ITEM_FIELD_DURABILITY) : 0);
        }

-        mails_count += 1;
+        mailsCount += 1;
+        realCount += 1;
    }

-    data.put<uint8>(0, mails_count);                        // set real send mails to client
+    data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount
+    data.put<uint8>(4, mailsCount); // set real send mails to client
    SendPacket(&data);

    // recalculate m_nextMailDelivereTime and unReadMails

bye

HiTmAn

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use