Thread Tools Display Modes
03/11/16, 11:40 PM   #1
QuadroTony
Banned
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 828
ZOS mail attachement bug

video without addons

i meet it many times and still cannot find a reason - everytime its different items, with different quality
just sometimes whel i put item in 6th slot its placed to 5th instead

and it cannot be fixed by reloadui, you need just change the order
no matter how i do it - by mouse or by E

www.youtube.com/watch?v=OXJ4Q-t0qOM
  Reply With Quote
03/13/16, 12:44 AM   #2
QuadroTony
Banned
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 828
guys how to fix with addons?
  Reply With Quote
03/13/16, 04:14 AM   #3
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
I have it also few times, and need to guess hwich are the correct ones to "fix" them...

I'll wait a bit, for myself, game is so buggy right now.
  Reply With Quote
03/13/16, 08:19 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
The problem is caused by the method GetQueuedItemAttachmentSlotIndex in inventoryslot.lua.
According to the comments on the function, it should return nil if it is called on an inventory slot that is not attached, but instead it will return slotIndex in that case.
This becomes a problem when the slotIndex is between 1 and 6.

For example when we have two items A and B with a slotIndex of 1 and 42 respectively, the following happens:
Code:
No attachments:
ItemA: GetQueuedItemAttachmentSlotIndex returns itemA.slotIndex (=1)
ItemB: GetQueuedItemAttachmentSlotIndex returns itemB.slotIndex (=42)

ItemA is attached:
ItemA: GetQueuedItemAttachmentSlotIndex returns i (=1)
ItemB: GetQueuedItemAttachmentSlotIndex returns itemB.slotIndex (=42)

ItemB is attached:
ItemA: GetQueuedItemAttachmentSlotIndex returns itemA.slotIndex (=1)
ItemB: GetQueuedItemAttachmentSlotIndex returns i (=1)
It should actually return this:
Code:
No attachments:
ItemA: GetQueuedItemAttachmentSlotIndex returns nil
ItemB: GetQueuedItemAttachmentSlotIndex returns nil

ItemA is attached:
ItemA: GetQueuedItemAttachmentSlotIndex returns i (=1)
ItemB: GetQueuedItemAttachmentSlotIndex returns nil

ItemB is attached:
ItemA: GetQueuedItemAttachmentSlotIndex returns nil
ItemB: GetQueuedItemAttachmentSlotIndex returns i (=1)
The original code:
Lua Code:
  1. local function GetQueuedItemAttachmentSlotIndex(inventorySlot)
  2.     local bag, attachmentIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  3.     if (bag) then
  4.         for i = 1, MAIL_MAX_ATTACHED_ITEMS do
  5.             local bagId, slotIndex = GetQueuedItemAttachmentInfo(i)
  6.             if bagId == bag and attachmentIndex == slotIndex then
  7.                 attachmentIndex = i
  8.                 break
  9.             end
  10.         end
  11.     end
  12.     return attachmentIndex
  13. end

What it should be:
Lua Code:
  1. local function GetQueuedItemAttachmentSlotIndex(inventorySlot)
  2.     local bag, attachmentIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  3.     if (bag) then
  4.         for i = 1, MAIL_MAX_ATTACHED_ITEMS do
  5.             local bagId, slotIndex = GetQueuedItemAttachmentInfo(i)
  6.             if bagId == bag and attachmentIndex == slotIndex then
  7.                 return i
  8.             end
  9.         end
  10.     end
  11.     return nil
  12. end

RemoveQueuedAttachment also needs to be adjusted, otherwise it would remove the item in the first attachment slot when nil is returned.
  Reply With Quote
03/14/16, 09:19 AM   #5
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Thanks for the info. We'll get it fixed.
  Reply With Quote
03/14/16, 09:30 AM   #6
QuadroTony
Banned
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 828
thsnks!
UPD. sometimes not only 5th and 6th slots messed, but 4th and 5th for example
  Reply With Quote
03/14/16, 03:57 PM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
I found another bug related to mail attachments.
When I have attachements added and close the menu, they get reattached when I open it again.
This works fine as long as there are no empty attachment slots.
For example if I have items added in slot 1,2 and 4, the item in slot 4 won't get reattached.

This is because ZO_MailSendShared_SavePendingMail in mailsend_shared.lua does not add an object to g_pendingAttachments for empty slots, but ZO_MailSendShared_RestorePendingMail uses ipairs to iterate over g_pendingAttachments, which does not work if there is a hole in the array.
Instead it should use for i = 1, MAIL_MAX_ATTACHED_ITEMS do and check if the element is nil plus some other changes that may be required.
  Reply With Quote
03/15/16, 12:59 AM   #8
Tonyleila
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 288
Originally Posted by ZOS_ChipHilseberg View Post
Thanks for the info. We'll get it fixed.
You shoud hire this guy!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » ZOS mail attachement bug

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off