Fix right click not adding attachments in twow 1.18
This commit is contained in:
+38
-6
@@ -657,8 +657,22 @@ function TurtleMail.hook.GetContainerItemInfo( bag, slot )
|
||||
end
|
||||
|
||||
function TurtleMail.hook.PickupContainerItem( bag, slot )
|
||||
if m.sendmail_attached( bag, slot ) then return end
|
||||
if m.api.GetContainerItemInfo( bag, slot ) then m.set_cursor_item( { bag, slot } ) end
|
||||
if m.sendmail_attached( bag, slot ) then
|
||||
if arg1 == "RightButton" and m.api.MailFrame:IsVisible() then
|
||||
return m.sendmail_remove_attachment( { bag, slot } )
|
||||
end
|
||||
return m.orig.PickupContainerItem( bag, slot )
|
||||
end
|
||||
|
||||
if m.api.GetContainerItemInfo( bag, slot ) then
|
||||
if arg1 == "RightButton" and m.api.MailFrame:IsVisible() then
|
||||
m.api.MailFrameTab_OnClick( 2 )
|
||||
m.sendmail_set_attachment( { bag, slot } )
|
||||
return
|
||||
else
|
||||
m.set_cursor_item( { bag, slot } )
|
||||
end
|
||||
end
|
||||
return m.orig.PickupContainerItem( bag, slot )
|
||||
end
|
||||
|
||||
@@ -926,6 +940,22 @@ function TurtleMail.attachment_button_on_click()
|
||||
end
|
||||
end
|
||||
|
||||
function TurtleMail.sendmail_remove_attachment( item )
|
||||
if not item then return end
|
||||
if type( item ) == "table" and m.sendmail_attached( item[ 1 ], item[ 2 ] ) then
|
||||
for i = 1, ATTACHMENTS_MAX do
|
||||
local btn = m.api[ "MailAttachment" .. i ]
|
||||
if btn.item and btn.item[ 1 ] == item[ 1 ] and btn.item[ 2 ] == item[ 2 ] then
|
||||
m.api[ "MailAttachment" .. i ].item = nil
|
||||
m.orig.PickupContainerItem( unpack( item ) )
|
||||
m.api.ClearCursor()
|
||||
m.api.SendMailFrame_Update()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- requires an item lock changed event for a proper update
|
||||
---@param item table
|
||||
---@param slot number?
|
||||
@@ -1561,10 +1591,12 @@ function TurtleMail.pfui_skin()
|
||||
m.api.pfUI.api.HandleIcon( self, self:GetNormalTexture() )
|
||||
|
||||
local link = m.api.GetContainerItemLink( button.item[ 1 ], button.item[ 2 ] )
|
||||
local _, _, linkstr = string.find( link, "(item:%d+:%d+:%d+:%d+)" )
|
||||
local _, _, quality = m.api.GetItemInfo( linkstr )
|
||||
local r, g, b = m.api.GetItemQualityColor( quality )
|
||||
self:SetBackdropBorderColor( r, g, b, 1 )
|
||||
if link then
|
||||
local _, _, linkstr = string.find( link, "(item:%d+:%d+:%d+:%d+)" )
|
||||
local _, _, quality = m.api.GetItemInfo( linkstr )
|
||||
local r, g, b = m.api.GetItemQualityColor( quality )
|
||||
self:SetBackdropBorderColor( r, g, b, 1 )
|
||||
end
|
||||
else
|
||||
self:SetBackdropBorderColor( m.api.pfUI.api.GetStringColor( m.api.pfUI_config.appearance.border.color ) )
|
||||
end
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
## Interface: 11200
|
||||
## Title: |cffabd473Turtle|cffffffffMail
|
||||
## Author: shirsig/sica
|
||||
## Version: 1.4.4
|
||||
## Version: 1.4.5
|
||||
## Notes: Mailbox enhancement
|
||||
## SavedVariables: TurtleMail_AutoCompleteNames
|
||||
## SavedVariablesPerCharacter: TurtleMail_To TurtleMail_Point TurtleMail_Log
|
||||
|
||||
Reference in New Issue
Block a user