Page 1 of 1

Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 12:17 pm
by Chuliganas
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

as the title says... Where items attached to mail are stored?
Table 'messages' only stores basic info. Where does message and items attached are stored?

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 12:21 pm
by jurchiks
Search in l2j code where `hasAttachments` is used and check what code is executed when the value is true.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 3:40 pm
by Chuliganas
aparently I don't know how to do that, because all I find is sql file for messages table..

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 4:17 pm
by jurchiks
Well then it's time to download the source code.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 4:58 pm
by lucan
The email attachments are in the table items but the LOC = MAIL in sender character.
The items change their place of LOC = INVENTORY to LOC = MAIL, even be RECEIVED by the other player or return to sender player and switch back to LOC = INVENTORY.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 5:07 pm
by Chuliganas
jurchiks wrote:Well then it's time to download the source code.
well the problem with the source code is that for some reason it gets stuck on file serverlistener.java and never gets pats it. tried to download it many times in last few weeks, still the same.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 5:08 pm
by Chuliganas
lucan wrote:The email attachments are in the table items but the LOC = MAIL in sender character.
The items change their place of LOC = INVENTORY to LOC = MAIL, even be RECEIVED by the other player or return to sender player and switch back to LOC = INVENTORY.
thanks. but there's no ID for mail, so still, the message text and items attached to certain message should be described somewhere besides items list.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 5:15 pm
by lucan
The attachment is linked to the ID of the player that sent it.
In table messages not need be described the attachments in messages, the server should look for items in the table items with the Sender ID and field LOC = MAIL when the player A sent an email to player B and the message is mark to have an attachment.
If you want to find an attachment to an email, search for the ID of the player sender in the messages table and look for items in the table items that have the ID of this sender and field LOC = MAIL.

select * from items where owner_id = xxxx and loc = 'MAIL'

xxxx = ID of the player who sent the e-mail.Take the xxxx in table messages in senderID of the message that you want.

ofc, if the receiver has not yet received the message!

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 8:18 pm
by jurchiks
If it's like that then there might be a problem; what happens when a single player has sent multiple items to multiple people? They will all have the same owner_id and same loc="MAIL" until the letters+attachments have been retrieved by the recipients. So there must be some separate place that stores the actual item IDs+count to be sent.

Re: Where items attached to mail are stored?

Posted: Fri Apr 20, 2012 10:42 pm
by lucan
The recipients of emails are in table items in field LOC_DATA when item is for MAIL.
I f you send three different emails with attach to three differents players, in table items at field LOC_DATA you see the 3 IDs of the 3 recipient players and no more the location of inventory or warehouse, the same ID of receiverID of table messages.

So an item that is part of an email, the field OWNER_ID = Sender, LOC = MAIL and LOC_DATA= ID of the recipient player.
Many items, you have a unique ID sender and many IDs recipient! :D

Re: Where items attached to mail are stored?

Posted: Thu Aug 31, 2017 8:51 am
by ShinichiYao
Then what about stackable items? they share same id but they can send to different people.

As I know somehow mail system cause item objectid duplicate, see this Issue:

https://bitbucket.org/l2jserver/l2j_ser ... -disappear

Re: Where items attached to mail are stored?

Posted: Fri Sep 01, 2017 2:14 am
by Sacrifice
Seems to be impossible due to this... in items table

Code: Select all

PRIMARY KEY (`object_id`),
  KEY `owner_id` (`owner_id`),
  KEY `item_id` (`item_id`),
  KEY `loc` (`loc`),
  KEY `time_of_use` (`time_of_use`)
Its impossible to do dulicated items or similar broking the primary key of a table. Till I know...

Re: Where items attached to mail are stored?

Posted: Fri Sep 01, 2017 2:55 am
by ShinichiYao
Sacrifice wrote: Fri Sep 01, 2017 2:14 am Its impossible to do dulicated items or similar broking the primary key of a table. Till I know...
But it could cause objectid of exist item release in idfactory on player delete mail.

Next time idfactory could generate an objectid of new item using this exist item's id that cause problem.

Re: Where items attached to mail are stored?

Posted: Fri Sep 01, 2017 10:27 am
by Sacrifice
Then its aprotection to... nots the normal function of the server... obviously. I understood the issue perfectly.
Then as the block of code tells in the issue comment...

gameserver/model/itemcontainer/Mail.java

Code: Select all

    @Override
    public void deleteMe()
    {
        _items.forEach(i ->
        {
            i.updateDatabase(true);
            i.deleteMe();
            L2World.getInstance().removeObject(i);
            // Could cause exist item's ObjectId release?
            // IdFactory.getInstance().releaseId(i.getObjectId());
        });
        _items.clear();
    }