Where items attached to mail are stored?

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Chuliganas
Posts: 80
Joined: Fri May 06, 2011 11:17 am

Where items attached to mail are stored?

Post 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?
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Where items attached to mail are stored?

Post by jurchiks »

Search in l2j code where `hasAttachments` is used and check what code is executed when the value is true.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Chuliganas
Posts: 80
Joined: Fri May 06, 2011 11:17 am

Re: Where items attached to mail are stored?

Post by Chuliganas »

aparently I don't know how to do that, because all I find is sql file for messages table..
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Where items attached to mail are stored?

Post by jurchiks »

Well then it's time to download the source code.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
User avatar
lucan
Posts: 590
Joined: Wed Mar 16, 2011 10:39 pm
Location: Brazil

Re: Where items attached to mail are stored?

Post 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.
Chuliganas
Posts: 80
Joined: Fri May 06, 2011 11:17 am

Re: Where items attached to mail are stored?

Post 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.
Chuliganas
Posts: 80
Joined: Fri May 06, 2011 11:17 am

Re: Where items attached to mail are stored?

Post 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.
User avatar
lucan
Posts: 590
Joined: Wed Mar 16, 2011 10:39 pm
Location: Brazil

Re: Where items attached to mail are stored?

Post 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!
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Where items attached to mail are stored?

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
User avatar
lucan
Posts: 590
Joined: Wed Mar 16, 2011 10:39 pm
Location: Brazil

Re: Where items attached to mail are stored?

Post 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
User avatar
ShinichiYao
Advanced User
Advanced User
Posts: 262
Joined: Tue Jan 12, 2016 3:53 am

Re: Where items attached to mail are stored?

Post 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
Sacrifice
Advanced User
Advanced User
Posts: 1026
Joined: Thu Aug 14, 2014 6:31 am

Re: Where items attached to mail are stored?

Post 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...
User avatar
ShinichiYao
Advanced User
Advanced User
Posts: 262
Joined: Tue Jan 12, 2016 3:53 am

Re: Where items attached to mail are stored?

Post 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.
Sacrifice
Advanced User
Advanced User
Posts: 1026
Joined: Thu Aug 14, 2014 6:31 am

Re: Where items attached to mail are stored?

Post 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();
    }
Post Reply