bugfixes, simplifications, refactoring
This commit is contained in:
+181
-282
@@ -1,16 +1,16 @@
|
|||||||
Postal = CreateFrame('Frame', nil, MailFrame)
|
postal = CreateFrame('Frame', nil, MailFrame)
|
||||||
local _G = getfenv(0)
|
local _G = getfenv(0)
|
||||||
setfenv(1, setmetatable(Postal, {__index=_G}))
|
setfenv(1, setmetatable(postal, {__index=_G}))
|
||||||
|
|
||||||
do
|
do
|
||||||
local f = CreateFrame'Frame'
|
local f = CreateFrame'Frame'
|
||||||
f:SetScript('OnEvent', function() Postal[event]() end)
|
f:SetScript('OnEvent', function() postal[event]() end)
|
||||||
for _, event in {'ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'BAG_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS'} do
|
for _, event in {'ADDON_LOADED', 'PLAYER_LOGIN', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'BAG_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS'} do
|
||||||
f:RegisterEvent(event)
|
f:RegisterEvent(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.Postal_Characters = {}
|
_G.postal_Characters = {}
|
||||||
|
|
||||||
local ATTACHMENTS_MAX = 21
|
local ATTACHMENTS_MAX = 21
|
||||||
local ATTACHMENTS_PER_ROW_SEND = 7
|
local ATTACHMENTS_PER_ROW_SEND = 7
|
||||||
@@ -18,35 +18,11 @@ local ATTACHMENTS_MAX_ROWS_SEND = 3
|
|||||||
|
|
||||||
function pack(...) return arg end
|
function pack(...) return arg end
|
||||||
|
|
||||||
hook, orig = {}, {}
|
orig = {}
|
||||||
function Hook(...)
|
hook = setmetatable({}, {__newindex=function(_, k, v) orig[k] = _G[k]; _G[k] = v end})
|
||||||
for i = 1, arg.n do
|
|
||||||
orig[arg[i]] = _G[arg[i]]
|
|
||||||
_G[arg[i]] = hook[arg[i]]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
|
||||||
local state
|
|
||||||
CreateFrame('Frame', nil, MailFrame):SetScript('OnUpdate', function()
|
|
||||||
if state and state.predicate() then
|
|
||||||
local callback = state.callback
|
|
||||||
state = nil
|
|
||||||
return callback()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
function When(predicate, callback)
|
|
||||||
state = {predicate=predicate, callback=callback}
|
|
||||||
end
|
|
||||||
function Wait(callback)
|
|
||||||
state = {predicate=function() return true end, callback=callback}
|
|
||||||
end
|
|
||||||
function Kill()
|
|
||||||
state = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
do
|
||||||
|
local f = CreateFrame'Frame'
|
||||||
local cursorItem
|
local cursorItem
|
||||||
function CURSOR_UPDATE()
|
function CURSOR_UPDATE()
|
||||||
cursorItem = nil
|
cursorItem = nil
|
||||||
@@ -55,7 +31,10 @@ do
|
|||||||
return cursorItem
|
return cursorItem
|
||||||
end
|
end
|
||||||
function SetCursorItem(item)
|
function SetCursorItem(item)
|
||||||
Wait(function() cursorItem = item end)
|
f:SetScript('OnUpdate', function()
|
||||||
|
cursorItem = item
|
||||||
|
f:SetScript('OnUpdate', nil)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -66,8 +45,8 @@ function BAG_UPDATE()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MAIL_CLOSED()
|
function MAIL_CLOSED()
|
||||||
Abort()
|
Inbox_Abort()
|
||||||
Inbox_selectedItems = {}
|
SendMail_Abort()
|
||||||
SendMail_Clear()
|
SendMail_Clear()
|
||||||
|
|
||||||
-- Hides the minimap unread mail button if there are no unread mail on closing the mailbox.
|
-- Hides the minimap unread mail button if there are no unread mail on closing the mailbox.
|
||||||
@@ -79,116 +58,78 @@ function MAIL_CLOSED()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MAIL_SEND_SUCCESS()
|
function MAIL_SEND_SUCCESS()
|
||||||
SendMail_ready = true
|
SendMail_sending = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function UI_ERROR_MESSAGE()
|
function UI_ERROR_MESSAGE()
|
||||||
if Inbox_opening then
|
if Inbox_opening then
|
||||||
if arg1 == ERR_INV_FULL then
|
if arg1 == ERR_INV_FULL then
|
||||||
Abort()
|
Inbox_Abort()
|
||||||
elseif arg1 == ERR_ITEM_MAX_COUNT then
|
elseif arg1 == ERR_ITEM_MAX_COUNT then
|
||||||
Inbox_skip = true
|
Inbox_skip = true
|
||||||
end
|
end
|
||||||
|
elseif SendMail_sending and (arg1 == ERR_MAIL_TO_SELF or arg1 == ERR_MAIL_TARGET_NOT_FOUND or arg1 == ERR_MAIL_REACHED_CAP) then
|
||||||
|
SendMail_sending = false
|
||||||
|
SendMail_Abort()
|
||||||
|
SendMail_state = nil
|
||||||
|
ClearCursor()
|
||||||
|
orig.ClickSendMailItemButton()
|
||||||
|
ClearCursor()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PLAYER_LOGIN()
|
function PLAYER_LOGIN()
|
||||||
local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player'
|
local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player'
|
||||||
Postal_Characters[key] = Postal_Characters[key] or {}
|
postal_Characters[key] = postal_Characters[key] or {}
|
||||||
for char, lastSeen in Postal_Characters[key] do
|
for char, lastSeen in postal_Characters[key] do
|
||||||
if GetTime() - lastSeen > 60 * 60 * 24 * 30 then
|
if GetTime() - lastSeen > 60 * 60 * 24 * 30 then
|
||||||
Postal_Characters[key][char] = nil
|
postal_Characters[key][char] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Postal_Characters[key][UnitName'player'] = GetTime()
|
postal_Characters[key][UnitName'player'] = GetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ADDON_LOADED()
|
function ADDON_LOADED()
|
||||||
if arg1 ~= 'Postal' then return end
|
if arg1 ~= 'postal' then return end
|
||||||
|
|
||||||
UIPanelWindows['MailFrame'].pushable = 1
|
UIPanelWindows.MailFrame.pushable = 1
|
||||||
UIPanelWindows['FriendsFrame'].pushable = 2
|
UIPanelWindows.FriendsFrame.pushable = 2
|
||||||
|
|
||||||
Inbox_Load()
|
Inbox_Load()
|
||||||
SendMail_Load()
|
SendMail_Load()
|
||||||
end
|
end
|
||||||
|
|
||||||
function VARIABLES_LOADED()
|
|
||||||
Hook(
|
|
||||||
'OpenMail_Reply',
|
|
||||||
'InboxFrame_Update','InboxFrame_OnClick', 'InboxFrameItem_OnEnter',
|
|
||||||
'SendMailFrame_Update', 'SendMailFrame_CanSend', 'ClickSendMailItemButton', 'GetContainerItemInfo', 'PickupContainerItem', 'SplitContainerItem', 'UseContainerItem'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function hook.OpenMail_Reply(...)
|
function hook.OpenMail_Reply(...)
|
||||||
_G.Postal_To = nil
|
_G.postal_To = nil
|
||||||
return orig.OpenMail_Reply(unpack(arg))
|
return orig.OpenMail_Reply(unpack(arg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Abort()
|
|
||||||
Kill()
|
|
||||||
Inbox_opening = false
|
|
||||||
Inbox_Lock()
|
|
||||||
end
|
|
||||||
|
|
||||||
function hook.InboxFrame_Update()
|
function hook.InboxFrame_Update()
|
||||||
orig.InboxFrame_Update()
|
orig.InboxFrame_Update()
|
||||||
for i = 1, 7 do
|
for i = 1, 7 do
|
||||||
local index = (i + (InboxFrame.pageNum - 1) * 7)
|
-- hack for tooltip update
|
||||||
local item = _G['MailItem' .. i]
|
_G['MailItem' .. i]:Hide()
|
||||||
item:Hide() -- hack for tooltip update
|
_G['MailItem' .. i]:Show()
|
||||||
item:Show()
|
|
||||||
if index > GetInboxNumItems() then
|
|
||||||
item.check:Hide()
|
|
||||||
else
|
|
||||||
item.check:Show()
|
|
||||||
item.check:SetChecked(Inbox_selectedItems[index])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Inbox_Lock()
|
Inbox_UpdateLock()
|
||||||
end
|
end
|
||||||
|
|
||||||
function hook.InboxFrame_OnClick(index)
|
function hook.InboxFrame_OnClick(index)
|
||||||
if Inbox_opening then
|
if Inbox_opening then
|
||||||
this:SetChecked(nil)
|
this:SetChecked(nil)
|
||||||
elseif arg1 == 'RightButton' then
|
elseif arg1 == 'RightButton' then
|
||||||
Abort()
|
Inbox_Open(index)
|
||||||
Inbox_OpenMail{index}
|
|
||||||
else
|
else
|
||||||
return orig.InboxFrame_OnClick(index)
|
return orig.InboxFrame_OnClick(index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hook.InboxFrameItem_OnEnter()
|
function hook.InboxFrameItem_OnEnter()
|
||||||
local tooltipSet
|
orig.InboxFrameItem_OnEnter()
|
||||||
GameTooltip:SetOwner(this, 'ANCHOR_RIGHT')
|
if GetInboxItem(this.index) then
|
||||||
if this.index then
|
GameTooltip:AddLine(ITEM_OPENABLE, '', 0, 1, 0)
|
||||||
if GetInboxItem(this.index) then
|
GameTooltip:Show()
|
||||||
GameTooltip:SetInboxItem(this.index)
|
|
||||||
tooltipSet = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if this.money then
|
|
||||||
GameTooltip:AddLine(ENCLOSED_MONEY, '', 1, 1, 1)
|
|
||||||
SetTooltipMoney(GameTooltip, this.money)
|
|
||||||
SetMoneyFrameColor('GameTooltipMoneyFrame', HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
|
|
||||||
elseif this.cod then
|
|
||||||
GameTooltip:AddLine(COD_AMOUNT, '', 1, 1, 1)
|
|
||||||
SetTooltipMoney(GameTooltip, this.cod)
|
|
||||||
if this.cod > GetMoney() then
|
|
||||||
SetMoneyFrameColor('GameTooltipMoneyFrame', RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
|
|
||||||
else
|
|
||||||
SetMoneyFrameColor('GameTooltipMoneyFrame', HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if tooltipSet and (this.money or this.cod) then
|
|
||||||
GameTooltip:SetHeight(GameTooltip:GetHeight() + _G['GameTooltipTextLeft' .. GameTooltip:NumLines()]:GetHeight())
|
|
||||||
if GameTooltipMoneyFrame:IsVisible() then
|
|
||||||
GameTooltip:SetHeight(GameTooltip:GetHeight() + GameTooltipMoneyFrame:GetHeight())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
GameTooltip:Show()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -204,100 +145,54 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Inbox_Load()
|
function Inbox_Load()
|
||||||
MailItem1:SetPoint('TOPLEFT', InboxFrame, 'TOPLEFT', 48, -80)
|
local btn = CreateFrame('Button', nil, InboxFrame, 'UIPanelButtonTemplate')
|
||||||
for i = 1, 7 do
|
btn:SetPoint('BOTTOM', -10, 90)
|
||||||
_G['MailItem' .. i .. 'ExpireTime']:SetPoint('TOPRIGHT', 'MailItem' .. i, 'TOPRIGHT', 10, -4)
|
btn:SetWidth(120)
|
||||||
_G['MailItem' .. i]:SetWidth(280)
|
btn:SetHeight(25)
|
||||||
local cb = CreateFrame('CheckButton', nil, _G['MailItem' .. i], 'OptionsCheckButtonTemplate')
|
btn:SetText(OPENMAIL)
|
||||||
cb:SetID(i)
|
btn:SetScript('OnClick', Inbox_OpenAll)
|
||||||
cb:SetWidth(24)
|
|
||||||
cb:SetHeight(24)
|
|
||||||
cb:SetPoint('RIGHT', _G['MailItem' .. i], 'LEFT', 1, 0)
|
|
||||||
cb:SetScript('OnClick', Inbox_SetSelected)
|
|
||||||
cb:SetHitRectInsets(0, 0, 0, 0)
|
|
||||||
cb:Hide()
|
|
||||||
_G['MailItem' .. i].check = cb
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
|
||||||
local btn = CreateFrame('Button', nil, InboxFrame, 'UIPanelButtonTemplate')
|
|
||||||
btn:SetPoint('BOTTOM', -10, 90)
|
|
||||||
btn:SetWidth(120)
|
|
||||||
btn:SetHeight(25)
|
|
||||||
btn:SetText(OPENMAIL)
|
|
||||||
btn:SetScript('OnClick', Inbox_Collect)
|
|
||||||
end
|
|
||||||
|
|
||||||
Inbox_selectedItems = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Inbox_SetSelected()
|
do
|
||||||
local index = this:GetID() + (InboxFrame.pageNum - 1) * 7
|
local i
|
||||||
Inbox_selectedItems[index] = this:GetChecked()
|
local f = CreateFrame'Frame'
|
||||||
end
|
f:Hide()
|
||||||
|
f:SetScript('OnUpdate', function()
|
||||||
function Inbox_Collect()
|
Inbox_opening = true
|
||||||
Abort()
|
if i > GetInboxNumItems() then
|
||||||
local selected = {}
|
Inbox_Abort()
|
||||||
if next(Inbox_selectedItems) then
|
elseif Inbox_Skip or not Inbox_Open(i) then
|
||||||
for i in Inbox_selectedItems do
|
Inbox_Skip = false
|
||||||
tinsert(selected, i)
|
i = i + 1
|
||||||
end
|
|
||||||
sort(selected)
|
|
||||||
else
|
|
||||||
for i = 1, GetInboxNumItems() do
|
|
||||||
tinsert(selected, i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Inbox_selectedItems = {}
|
|
||||||
Inbox_opening = true
|
|
||||||
Inbox_Lock()
|
|
||||||
Inbox_OpenMail(selected)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Inbox_OpenMail(selected)
|
|
||||||
if getn(selected) == 0 then
|
|
||||||
Inbox_opening = false
|
|
||||||
Inbox_Lock()
|
|
||||||
else
|
|
||||||
Inbox_OpenItem(selected[1], GetInboxNumItems(), selected)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Inbox_OpenItem(i, inboxCount, selected)
|
|
||||||
Wait(function()
|
|
||||||
local _, _, _, _, money, COD, _, item = GetInboxHeaderInfo(i)
|
|
||||||
local newInboxCount = GetInboxNumItems()
|
|
||||||
|
|
||||||
if newInboxCount < inboxCount or COD > 0 or Inbox_skip then
|
|
||||||
Inbox_skip = false
|
|
||||||
tremove(selected, 1)
|
|
||||||
if newInboxCount < inboxCount then
|
|
||||||
for j in selected do
|
|
||||||
selected[j] = selected[j] - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return Inbox_OpenMail(selected)
|
|
||||||
elseif item then
|
|
||||||
TakeInboxItem(i)
|
|
||||||
When(function() return not ({GetInboxHeaderInfo(i)})[8] or GetInboxNumItems() < inboxCount or Inbox_skip end, function()
|
|
||||||
return Inbox_OpenItem(i, inboxCount, selected)
|
|
||||||
end)
|
|
||||||
elseif money > 0 then
|
|
||||||
TakeInboxMoney(i)
|
|
||||||
When(function() return ({GetInboxHeaderInfo(i)})[5] == 0 or GetInboxNumItems() < inboxCount or Inbox_skip end, function()
|
|
||||||
return Inbox_OpenItem(i, inboxCount, selected)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
DeleteInboxItem(i)
|
|
||||||
When(function() return GetInboxNumItems() < inboxCount or Inbox_skip end, function()
|
|
||||||
return Inbox_OpenItem(i, inboxCount, selected)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
function Inbox_OpenAll()
|
||||||
|
Inbox_opening = true
|
||||||
|
Inbox_UpdateLock()
|
||||||
|
i = 1
|
||||||
|
Inbox_skip = false
|
||||||
|
f:Show()
|
||||||
|
end
|
||||||
|
function Inbox_Abort()
|
||||||
|
Inbox_opening = false
|
||||||
|
Inbox_UpdateLock()
|
||||||
|
f:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Inbox_Lock()
|
function Inbox_Open(i)
|
||||||
|
local _, _, _, _, _, COD = GetInboxHeaderInfo(i)
|
||||||
|
if COD > 0 then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
TakeInboxMoney(i)
|
||||||
|
TakeInboxItem(i)
|
||||||
|
DeleteInboxItem(i)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Inbox_UpdateLock()
|
||||||
for i = 1, 7 do
|
for i = 1, 7 do
|
||||||
_G['MailItem' .. i .. 'ButtonIcon']:SetDesaturated(Inbox_opening)
|
_G['MailItem' .. i .. 'ButtonIcon']:SetDesaturated(Inbox_opening)
|
||||||
if Inbox_opening then
|
if Inbox_opening then
|
||||||
@@ -314,7 +209,7 @@ function hook.SendMailFrame_Update()
|
|||||||
local last = SendMail_NumAttachments()
|
local last = SendMail_NumAttachments()
|
||||||
|
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
local btn = _G['PostalAttachment' .. i]
|
local btn = _G['postalAttachment' .. i]
|
||||||
|
|
||||||
local texture, count
|
local texture, count
|
||||||
if btn.item then
|
if btn.item then
|
||||||
@@ -371,8 +266,8 @@ function hook.SendMailFrame_Update()
|
|||||||
local marginxl = 8 + 6
|
local marginxl = 8 + 6
|
||||||
local marginxr = 40 + 6
|
local marginxr = 40 + 6
|
||||||
local areax = SendMailFrame:GetWidth() - marginxl - marginxr
|
local areax = SendMailFrame:GetWidth() - marginxl - marginxr
|
||||||
local iconx = PostalAttachment1:GetWidth() + 2
|
local iconx = postalAttachment1:GetWidth() + 2
|
||||||
local icony = PostalAttachment1:GetHeight() + 2
|
local icony = postalAttachment1:GetHeight() + 2
|
||||||
local gapx1 = floor((areax - (iconx * ATTACHMENTS_PER_ROW_SEND)) / (ATTACHMENTS_PER_ROW_SEND - 1))
|
local gapx1 = floor((areax - (iconx * ATTACHMENTS_PER_ROW_SEND)) / (ATTACHMENTS_PER_ROW_SEND - 1))
|
||||||
local gapx2 = floor((areax - (iconx * ATTACHMENTS_PER_ROW_SEND) - (gapx1 * (ATTACHMENTS_PER_ROW_SEND - 1))) / 2)
|
local gapx2 = floor((areax - (iconx * ATTACHMENTS_PER_ROW_SEND) - (gapx1 * (ATTACHMENTS_PER_ROW_SEND - 1))) / 2)
|
||||||
local gapy1 = 5
|
local gapy1 = 5
|
||||||
@@ -384,7 +279,7 @@ function hook.SendMailFrame_Update()
|
|||||||
local taby = (icony + gapy1)
|
local taby = (icony + gapy1)
|
||||||
local scrollHeight = 249 - areay
|
local scrollHeight = 249 - areay
|
||||||
|
|
||||||
PostalHorizontalBarLeft:SetPoint('TOPLEFT', SendMailFrame, 'BOTTOMLEFT', 2 + 15, 184 + areay - 14)
|
postalHorizontalBarLeft:SetPoint('TOPLEFT', SendMailFrame, 'BOTTOMLEFT', 2 + 15, 184 + areay - 14)
|
||||||
|
|
||||||
SendMailScrollFrame:SetHeight(scrollHeight)
|
SendMailScrollFrame:SetHeight(scrollHeight)
|
||||||
SendMailScrollChildFrame:SetHeight(scrollHeight)
|
SendMailScrollChildFrame:SetHeight(scrollHeight)
|
||||||
@@ -403,9 +298,9 @@ function hook.SendMailFrame_Update()
|
|||||||
-- Set Items
|
-- Set Items
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
if cursory >= 0 then
|
if cursory >= 0 then
|
||||||
_G['PostalAttachment' .. i]:Enable()
|
_G['postalAttachment' .. i]:Enable()
|
||||||
_G['PostalAttachment' .. i]:Show()
|
_G['postalAttachment' .. i]:Show()
|
||||||
_G['PostalAttachment' .. i]:SetPoint('TOPLEFT', 'SendMailFrame', 'BOTTOMLEFT', indentx + (tabx * cursorx), indenty + (taby * cursory))
|
_G['postalAttachment' .. i]:SetPoint('TOPLEFT', 'SendMailFrame', 'BOTTOMLEFT', indentx + (tabx * cursorx), indenty + (taby * cursory))
|
||||||
|
|
||||||
cursorx = cursorx + 1
|
cursorx = cursorx + 1
|
||||||
if cursorx >= ATTACHMENTS_PER_ROW_SEND then
|
if cursorx >= ATTACHMENTS_PER_ROW_SEND then
|
||||||
@@ -413,21 +308,13 @@ function hook.SendMailFrame_Update()
|
|||||||
cursorx = 0
|
cursorx = 0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
_G['PostalAttachment' .. i]:Hide()
|
_G['postalAttachment' .. i]:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
SendMailFrame_CanSend()
|
SendMailFrame_CanSend()
|
||||||
end
|
end
|
||||||
|
|
||||||
function hook.SendMailFrame_CanSend()
|
|
||||||
if strlen(SendMailNameEditBox:GetText()) > 0 and (SendMailSendMoneyButton:GetChecked() and MoneyInputFrame_GetCopper(SendMailMoney) or 0) + GetSendMailPrice() * max(1, SendMail_NumAttachments()) <= GetMoney() then
|
|
||||||
PostalMailButton:Enable()
|
|
||||||
else
|
|
||||||
PostalMailButton:Disable()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function hook.ClickSendMailItemButton()
|
function hook.ClickSendMailItemButton()
|
||||||
SendMail_SetAttachment(GetCursorItem())
|
SendMail_SetAttachment(GetCursorItem())
|
||||||
end
|
end
|
||||||
@@ -453,7 +340,8 @@ function hook.UseContainerItem(bag, slot, onself)
|
|||||||
if SendMail_Attached(bag, slot) then return end
|
if SendMail_Attached(bag, slot) then return end
|
||||||
if IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() then
|
if IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() then
|
||||||
return orig.UseContainerItem(bag, slot, onself)
|
return orig.UseContainerItem(bag, slot, onself)
|
||||||
elseif SendMailFrame:IsVisible() then
|
elseif MailFrame:IsVisible() then
|
||||||
|
MailFrameTab_OnClick(2)
|
||||||
SendMail_SetAttachment{bag, slot}
|
SendMail_SetAttachment{bag, slot}
|
||||||
elseif TradeFrame:IsVisible() then
|
elseif TradeFrame:IsVisible() then
|
||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
@@ -468,16 +356,15 @@ function hook.UseContainerItem(bag, slot, onself)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PostalMailButton_OnClick()
|
function postalMailButton_OnClick()
|
||||||
Abort()
|
postalAutoCompleteBox:Hide()
|
||||||
PostalAutoCompleteBox:Hide()
|
|
||||||
|
|
||||||
_G.Postal_To = SendMailNameEditBox:GetText()
|
_G.postal_To = SendMailNameEditBox:GetText()
|
||||||
SendMailNameEditBox:HighlightText()
|
SendMailNameEditBox:HighlightText()
|
||||||
|
|
||||||
SendMail_state = {
|
SendMail_state = {
|
||||||
to = Postal_To,
|
to = postal_To,
|
||||||
subject = PostalSubjectEditBox:GetText(),
|
subject = postalSubjectEditBox:GetText(),
|
||||||
body = SendMailBodyEditBox:GetText(),
|
body = SendMailBodyEditBox:GetText(),
|
||||||
money = MoneyInputFrame_GetCopper(SendMailMoney),
|
money = MoneyInputFrame_GetCopper(SendMailMoney),
|
||||||
cod = SendMailCODButton:GetChecked(),
|
cod = SendMailCODButton:GetChecked(),
|
||||||
@@ -486,26 +373,21 @@ function PostalMailButton_OnClick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendMail_Clear()
|
SendMail_Clear()
|
||||||
|
SendMail_SendAll()
|
||||||
When(function()
|
|
||||||
return SendMail_ready
|
|
||||||
end, function()
|
|
||||||
SendMail_Send()
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SendMail_Load()
|
function SendMail_Load()
|
||||||
SendMailFrame:CreateTexture('PostalHorizontalBarLeft', 'BACKGROUND')
|
SendMailFrame:CreateTexture('postalHorizontalBarLeft', 'BACKGROUND')
|
||||||
PostalHorizontalBarLeft:SetTexture([[Interface\ClassTrainerFrame\UI-ClassTrainer-HorizontalBar]])
|
postalHorizontalBarLeft:SetTexture([[Interface\ClassTrainerFrame\UI-ClassTrainer-HorizontalBar]])
|
||||||
PostalHorizontalBarLeft:SetWidth(256)
|
postalHorizontalBarLeft:SetWidth(256)
|
||||||
PostalHorizontalBarLeft:SetHeight(16)
|
postalHorizontalBarLeft:SetHeight(16)
|
||||||
PostalHorizontalBarLeft:SetTexCoord(0, 1, 0, .25)
|
postalHorizontalBarLeft:SetTexCoord(0, 1, 0, .25)
|
||||||
SendMailFrame:CreateTexture('PostalHorizontalBarRight', 'BACKGROUND')
|
SendMailFrame:CreateTexture('postalHorizontalBarRight', 'BACKGROUND')
|
||||||
PostalHorizontalBarRight:SetTexture([[Interface\ClassTrainerFrame\UI-ClassTrainer-HorizontalBar]])
|
postalHorizontalBarRight:SetTexture([[Interface\ClassTrainerFrame\UI-ClassTrainer-HorizontalBar]])
|
||||||
PostalHorizontalBarRight:SetWidth(75)
|
postalHorizontalBarRight:SetWidth(75)
|
||||||
PostalHorizontalBarRight:SetHeight(16)
|
postalHorizontalBarRight:SetHeight(16)
|
||||||
PostalHorizontalBarRight:SetTexCoord(0, .29296875, .25, .5)
|
postalHorizontalBarRight:SetTexCoord(0, .29296875, .25, .5)
|
||||||
PostalHorizontalBarRight:SetPoint('LEFT', PostalHorizontalBarLeft, 'RIGHT')
|
postalHorizontalBarRight:SetPoint('LEFT', postalHorizontalBarLeft, 'RIGHT')
|
||||||
|
|
||||||
do
|
do
|
||||||
local background = ({SendMailPackageButton:GetRegions()})[1]
|
local background = ({SendMailPackageButton:GetRegions()})[1]
|
||||||
@@ -535,61 +417,61 @@ function SendMail_Load()
|
|||||||
SendMailSendMoneyButton:SetPoint('TOPLEFT', SendMailMoney, 'TOPRIGHT', 0, 12)
|
SendMailSendMoneyButton:SetPoint('TOPLEFT', SendMailMoney, 'TOPRIGHT', 0, 12)
|
||||||
|
|
||||||
-- hack to avoid automatic subject setting and button disabling from weird blizzard code
|
-- hack to avoid automatic subject setting and button disabling from weird blizzard code
|
||||||
PostalMailButton = SendMailMailButton
|
postalMailButton = SendMailMailButton
|
||||||
_G.SendMailMailButton = setmetatable({}, {__index = function() return function() end end})
|
_G.SendMailMailButton = setmetatable({}, {__index = function() return function() end end})
|
||||||
_G.SendMailMailButton_OnClick = PostalMailButton_OnClick
|
_G.SendMailMailButton_OnClick = postalMailButton_OnClick
|
||||||
PostalSubjectEditBox = SendMailSubjectEditBox
|
postalSubjectEditBox = SendMailSubjectEditBox
|
||||||
_G.SendMailSubjectEditBox = setmetatable({}, {
|
_G.SendMailSubjectEditBox = setmetatable({}, {
|
||||||
__index = function(_, key)
|
__index = function(_, key)
|
||||||
return function(_, ...)
|
return function(_, ...)
|
||||||
return PostalSubjectEditBox[key](PostalSubjectEditBox, unpack(arg))
|
return postalSubjectEditBox[key](postalSubjectEditBox, unpack(arg))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
SendMailNameEditBox._SetText = SendMailNameEditBox.SetText
|
SendMailNameEditBox._SetText = SendMailNameEditBox.SetText
|
||||||
function SendMailNameEditBox:SetText(...)
|
function SendMailNameEditBox:SetText(...)
|
||||||
if not Postal_To then
|
if not postal_To then
|
||||||
return self:_SetText(unpack(arg))
|
return self:_SetText(unpack(arg))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
SendMailNameEditBox:SetScript('OnShow', function()
|
SendMailNameEditBox:SetScript('OnShow', function()
|
||||||
if Postal_To then
|
if postal_To then
|
||||||
this:_SetText(Postal_To)
|
this:_SetText(postal_To)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
SendMailNameEditBox:SetScript('OnChar', function()
|
SendMailNameEditBox:SetScript('OnChar', function()
|
||||||
_G.Postal_To = nil
|
_G.postal_To = nil
|
||||||
GetSuggestions()
|
GetSuggestions()
|
||||||
end)
|
end)
|
||||||
SendMailNameEditBox:SetScript('OnTabPressed', function()
|
SendMailNameEditBox:SetScript('OnTabPressed', function()
|
||||||
if PostalAutoCompleteBox:IsVisible() then
|
if postalAutoCompleteBox:IsVisible() then
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
PreviousMatch()
|
PreviousMatch()
|
||||||
else
|
else
|
||||||
NextMatch()
|
NextMatch()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
PostalSubjectEditBox:SetFocus()
|
postalSubjectEditBox:SetFocus()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
SendMailNameEditBox:SetScript('OnEnterPressed', function()
|
SendMailNameEditBox:SetScript('OnEnterPressed', function()
|
||||||
if PostalAutoCompleteBox:IsVisible() then
|
if postalAutoCompleteBox:IsVisible() then
|
||||||
PostalAutoCompleteBox:Hide()
|
postalAutoCompleteBox:Hide()
|
||||||
this:HighlightText(0, 0)
|
this:HighlightText(0, 0)
|
||||||
else
|
else
|
||||||
PostalSubjectEditBox:SetFocus()
|
postalSubjectEditBox:SetFocus()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
SendMailNameEditBox:SetScript('OnEscapePressed', function()
|
SendMailNameEditBox:SetScript('OnEscapePressed', function()
|
||||||
if PostalAutoCompleteBox:IsVisible() then
|
if postalAutoCompleteBox:IsVisible() then
|
||||||
PostalAutoCompleteBox:Hide()
|
postalAutoCompleteBox:Hide()
|
||||||
else
|
else
|
||||||
this:ClearFocus()
|
this:ClearFocus()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
function SendMailNameEditBox.focusLoss()
|
function SendMailNameEditBox.focusLoss()
|
||||||
PostalAutoCompleteBox:Hide()
|
postalAutoCompleteBox:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, editBox in {SendMailNameEditBox, SendMailSubjectEditBox} do
|
for _, editBox in {SendMailNameEditBox, SendMailSubjectEditBox} do
|
||||||
@@ -614,25 +496,46 @@ function SendMail_Load()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
SendMail_ready = true
|
do
|
||||||
|
local f = CreateFrame'Frame'
|
||||||
|
f:Hide()
|
||||||
|
f:SetScript('OnUpdate', function()
|
||||||
|
if not SendMail_sending then
|
||||||
|
SendMail_Send()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
function SendMail_SendAll()
|
||||||
|
f:Show()
|
||||||
|
end
|
||||||
|
function SendMail_Abort()
|
||||||
|
f:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function hook.SendMailFrame_CanSend()
|
||||||
|
if not SendMail_sending and strlen(SendMailNameEditBox:GetText()) > 0 and (SendMailSendMoneyButton:GetChecked() and MoneyInputFrame_GetCopper(SendMailMoney) or 0) + GetSendMailPrice() * max(1, SendMail_NumAttachments()) <= GetMoney() then
|
||||||
|
postalMailButton:Enable()
|
||||||
|
else
|
||||||
|
postalMailButton:Disable()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SendMail_Attached(bag, slot)
|
function SendMail_Attached(bag, slot)
|
||||||
if not MailFrame:IsVisible() then return false end
|
if not MailFrame:IsVisible() then return false end
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
local btn = _G['PostalAttachment' .. i]
|
local btn = _G['postalAttachment' .. i]
|
||||||
if btn.item and btn.item[1] == bag and btn.item[2] == slot then
|
if btn.item and btn.item[1] == bag and btn.item[2] == slot then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not SendMail_state then
|
if SendMail_state then
|
||||||
return
|
for _, attachment in SendMail_state.attachments do
|
||||||
end
|
if attachment[1] == bag and attachment[2] == slot then
|
||||||
for _, attachment in SendMail_state.attachments do
|
return true
|
||||||
if attachment[1] == bag and attachment[2] == slot then
|
end
|
||||||
return true
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -655,8 +558,8 @@ function SendMail_SetAttachment(item, slot)
|
|||||||
return
|
return
|
||||||
elseif not slot then
|
elseif not slot then
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
if not _G['PostalAttachment' .. i].item then
|
if not _G['postalAttachment' .. i].item then
|
||||||
slot = _G['PostalAttachment' .. i]
|
slot = _G['postalAttachment' .. i]
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -682,41 +585,41 @@ function SendMail_PickupMailable(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SendMail_NumAttachments()
|
function SendMail_NumAttachments()
|
||||||
local num = 0
|
local x = 0
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
if _G['PostalAttachment' .. i].item then
|
if _G['postalAttachment' .. i].item then
|
||||||
num = num + 1
|
x = x + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return num
|
return x
|
||||||
end
|
end
|
||||||
|
|
||||||
function SendMail_Attachments()
|
function SendMail_Attachments()
|
||||||
local arr = {}
|
local t = {}
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
local btn = _G['PostalAttachment' .. i]
|
local btn = _G['postalAttachment' .. i]
|
||||||
if btn.item then
|
if btn.item then
|
||||||
tinsert(arr, btn.item)
|
tinsert(t, btn.item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return arr
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
function SendMail_Clear()
|
function SendMail_Clear()
|
||||||
local anyItem
|
local anyItem
|
||||||
for i = 1, ATTACHMENTS_MAX do
|
for i = 1, ATTACHMENTS_MAX do
|
||||||
anyItem = anyItem or _G['PostalAttachment' .. i].item
|
anyItem = anyItem or _G['postalAttachment' .. i].item
|
||||||
_G['PostalAttachment' .. i].item = nil
|
_G['postalAttachment' .. i].item = nil
|
||||||
end
|
end
|
||||||
if anyItem then
|
if anyItem then
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
PickupContainerItem(unpack(anyItem))
|
PickupContainerItem(unpack(anyItem))
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
end
|
end
|
||||||
PostalMailButton:Disable()
|
postalMailButton:Disable()
|
||||||
SendMailNameEditBox:SetText''
|
SendMailNameEditBox:SetText''
|
||||||
SendMailNameEditBox:SetFocus()
|
SendMailNameEditBox:SetFocus()
|
||||||
PostalSubjectEditBox:SetText''
|
postalSubjectEditBox:SetText''
|
||||||
SendMailBodyEditBox:SetText''
|
SendMailBodyEditBox:SetText''
|
||||||
MoneyInputFrame_ResetMoney(SendMailMoney)
|
MoneyInputFrame_ResetMoney(SendMailMoney)
|
||||||
SendMailRadioButton_OnClick(1)
|
SendMailRadioButton_OnClick(1)
|
||||||
@@ -734,7 +637,7 @@ function SendMail_Send()
|
|||||||
orig.ClickSendMailItemButton()
|
orig.ClickSendMailItemButton()
|
||||||
|
|
||||||
if not GetSendMailItem() then
|
if not GetSendMailItem() then
|
||||||
DEFAULT_CHAT_FRAME:AddMessage('Postal: ' .. ERROR_CAPS, 1, 0, 0)
|
DEFAULT_CHAT_FRAME:AddMessage('postal: ' .. ERROR_CAPS, 1, 0, 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -762,14 +665,10 @@ function SendMail_Send()
|
|||||||
end
|
end
|
||||||
|
|
||||||
SendMail(SendMail_state.to, subject, SendMail_state.body)
|
SendMail(SendMail_state.to, subject, SendMail_state.body)
|
||||||
SendMail_ready = false
|
SendMail_sending = true
|
||||||
|
|
||||||
if getn(SendMail_state.attachments) > 0 then
|
if getn(SendMail_state.attachments) == 0 then
|
||||||
When(function()
|
SendMail_Abort()
|
||||||
return SendMail_ready
|
|
||||||
end, function()
|
|
||||||
SendMail_Send()
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -782,7 +681,7 @@ do
|
|||||||
SendMailNameEditBox:SetText(matches[index])
|
SendMailNameEditBox:SetText(matches[index])
|
||||||
SendMailNameEditBox:HighlightText(inputLength, -1)
|
SendMailNameEditBox:HighlightText(inputLength, -1)
|
||||||
for i = 1, POSTAL_AUTOCOMPLETE_MAX_BUTTONS do
|
for i = 1, POSTAL_AUTOCOMPLETE_MAX_BUTTONS do
|
||||||
local button = _G['PostalAutoCompleteButton' .. i]
|
local button = _G['postalAutoCompleteButton' .. i]
|
||||||
if i == index then
|
if i == index then
|
||||||
button:LockHighlight()
|
button:LockHighlight()
|
||||||
else
|
else
|
||||||
@@ -808,7 +707,7 @@ do
|
|||||||
function SelectMatch(i)
|
function SelectMatch(i)
|
||||||
index = i
|
index = i
|
||||||
complete()
|
complete()
|
||||||
PostalAutoCompleteBox:Hide()
|
postalAutoCompleteBox:Hide()
|
||||||
SendMailNameEditBox:HighlightText(0, 0)
|
SendMailNameEditBox:HighlightText(0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -828,7 +727,7 @@ do
|
|||||||
ignore[name] = true
|
ignore[name] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for character in Postal_Characters[GetCVar'realmName' .. '|' .. UnitFactionGroup'player'] do
|
for character in postal_Characters[GetCVar'realmName' .. '|' .. UnitFactionGroup'player'] do
|
||||||
process(character)
|
process(character)
|
||||||
end
|
end
|
||||||
for i = 1, GetNumFriends() do
|
for i = 1, GetNumFriends() do
|
||||||
@@ -841,7 +740,7 @@ do
|
|||||||
table.setn(matches, min(getn(matches), POSTAL_AUTOCOMPLETE_MAX_BUTTONS))
|
table.setn(matches, min(getn(matches), POSTAL_AUTOCOMPLETE_MAX_BUTTONS))
|
||||||
if getn(matches) > 0 and (getn(matches) > 1 or input ~= matches[1]) then
|
if getn(matches) > 0 and (getn(matches) > 1 or input ~= matches[1]) then
|
||||||
for i = 1, POSTAL_AUTOCOMPLETE_MAX_BUTTONS do
|
for i = 1, POSTAL_AUTOCOMPLETE_MAX_BUTTONS do
|
||||||
local button = _G['PostalAutoCompleteButton' .. i]
|
local button = _G['postalAutoCompleteButton' .. i]
|
||||||
if i <= getn(matches) then
|
if i <= getn(matches) then
|
||||||
button:SetText(matches[i])
|
button:SetText(matches[i])
|
||||||
button:GetFontString():SetPoint('LEFT', button, 'LEFT', 15, 0)
|
button:GetFontString():SetPoint('LEFT', button, 'LEFT', 15, 0)
|
||||||
@@ -850,13 +749,13 @@ do
|
|||||||
button:Hide()
|
button:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
PostalAutoCompleteBox:SetHeight(getn(matches) * PostalAutoCompleteButton1:GetHeight() + 35)
|
postalAutoCompleteBox:SetHeight(getn(matches) * postalAutoCompleteButton1:GetHeight() + 35)
|
||||||
PostalAutoCompleteBox:SetWidth(120)
|
postalAutoCompleteBox:SetWidth(120)
|
||||||
PostalAutoCompleteBox:Show()
|
postalAutoCompleteBox:Show()
|
||||||
index = 1
|
index = 1
|
||||||
complete()
|
complete()
|
||||||
else
|
else
|
||||||
PostalAutoCompleteBox:Hide()
|
postalAutoCompleteBox:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
## Interface: 11200
|
## Interface: 11200
|
||||||
## Title: Postal
|
## Title: postal
|
||||||
## Notes: Mailbox automation
|
## Notes: Mailbox automation
|
||||||
## Author: shirsig
|
## Author: shirsig
|
||||||
## SavedVariablesPerCharacter: Postal_To
|
## SavedVariablesPerCharacter: postal_To
|
||||||
## SavedVariables: Postal_Characters
|
## SavedVariables: postal_Characters
|
||||||
Postal.xml
|
postal.xml
|
||||||
+43
-43
@@ -1,17 +1,17 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||||
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
||||||
<Script file="Postal.lua"/>
|
<Script file="postal.lua"/>
|
||||||
|
|
||||||
<Button name="PostalAutoCompleteButtonTemplate" virtual="true">
|
<Button name="postalAutoCompleteButtonTemplate" virtual="true">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="120" y="14"/>
|
<AbsDimension x="120" y="14"/>
|
||||||
</Size>
|
</Size>
|
||||||
<Scripts>
|
<Scripts>
|
||||||
<OnClick>
|
<OnClick>
|
||||||
Postal.SelectMatch(this:GetID())
|
postal.SelectMatch(this:GetID())
|
||||||
</OnClick>
|
</OnClick>
|
||||||
<OnTabPressed>
|
<OnTabPressed>
|
||||||
Postal.NextMatch()
|
postal.NextMatch()
|
||||||
</OnTabPressed>
|
</OnTabPressed>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
<NormalFont inherits="GameFontNormal"/>
|
<NormalFont inherits="GameFontNormal"/>
|
||||||
@@ -19,7 +19,7 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
<DisabledFont inherits="GameFontDisable"/>
|
<DisabledFont inherits="GameFontDisable"/>
|
||||||
<HighlightTexture inherits="UIPanelButtonHighlightTexture"/>
|
<HighlightTexture inherits="UIPanelButtonHighlightTexture"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Frame name="PostalAutoCompleteBox" parent="SendMailNameEditBox" frameStrata="DIALOG" hidden="true">
|
<Frame name="postalAutoCompleteBox" parent="SendMailNameEditBox" frameStrata="DIALOG" hidden="true">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="5" y="5"/>
|
<AbsDimension x="5" y="5"/>
|
||||||
</Size>
|
</Size>
|
||||||
@@ -39,7 +39,7 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
</Backdrop>
|
</Backdrop>
|
||||||
<Layers>
|
<Layers>
|
||||||
<Layer level="ARTWORK">
|
<Layer level="ARTWORK">
|
||||||
<FontString name="PostalAutoCompleteInstructions" inherits="GameFontDisableSmall">
|
<FontString name="postalAutoCompleteInstructions" inherits="GameFontDisableSmall">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="BOTTOMLEFT">
|
<Anchor point="BOTTOMLEFT">
|
||||||
<Offset>
|
<Offset>
|
||||||
@@ -51,34 +51,34 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
</Layer>
|
</Layer>
|
||||||
</Layers>
|
</Layers>
|
||||||
<Frames>
|
<Frames>
|
||||||
<Button name="PostalAutoCompleteButton1" inherits="PostalAutoCompleteButtonTemplate" id="1">
|
<Button name="postalAutoCompleteButton1" inherits="postalAutoCompleteButtonTemplate" id="1">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="TOPLEFT">
|
<Anchor point="TOPLEFT">
|
||||||
<Offset>
|
<Offset>
|
||||||
<!--This 10 is a magic number used in PostalAutoComplete_Update when checking whether the PostalAutoComplete box should be above or below the EditBox. Please update the number there if you change it here-->
|
<!--This 10 is a magic number used in postalAutoComplete_Update when checking whether the postalAutoComplete box should be above or below the EditBox. Please update the number there if you change it here-->
|
||||||
<AbsDimension x="0" y="-10"/>
|
<AbsDimension x="0" y="-10"/>
|
||||||
</Offset>
|
</Offset>
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
</Button>
|
</Button>
|
||||||
<Button name="PostalAutoCompleteButton2" inherits="PostalAutoCompleteButtonTemplate" id="2">
|
<Button name="postalAutoCompleteButton2" inherits="postalAutoCompleteButtonTemplate" id="2">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="TOPLEFT" relativeTo="PostalAutoCompleteButton1" relativePoint="BOTTOMLEFT"/>
|
<Anchor point="TOPLEFT" relativeTo="postalAutoCompleteButton1" relativePoint="BOTTOMLEFT"/>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
</Button>
|
</Button>
|
||||||
<Button name="PostalAutoCompleteButton3" inherits="PostalAutoCompleteButtonTemplate" id="3">
|
<Button name="postalAutoCompleteButton3" inherits="postalAutoCompleteButtonTemplate" id="3">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="TOPLEFT" relativeTo="PostalAutoCompleteButton2" relativePoint="BOTTOMLEFT"/>
|
<Anchor point="TOPLEFT" relativeTo="postalAutoCompleteButton2" relativePoint="BOTTOMLEFT"/>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
</Button>
|
</Button>
|
||||||
<Button name="PostalAutoCompleteButton4" inherits="PostalAutoCompleteButtonTemplate" id="4">
|
<Button name="postalAutoCompleteButton4" inherits="postalAutoCompleteButtonTemplate" id="4">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="TOPLEFT" relativeTo="PostalAutoCompleteButton3" relativePoint="BOTTOMLEFT"/>
|
<Anchor point="TOPLEFT" relativeTo="postalAutoCompleteButton3" relativePoint="BOTTOMLEFT"/>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
</Button>
|
</Button>
|
||||||
<Button name="PostalAutoCompleteButton5" inherits="PostalAutoCompleteButtonTemplate" id="5">
|
<Button name="postalAutoCompleteButton5" inherits="postalAutoCompleteButtonTemplate" id="5">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
<Anchor point="TOPLEFT" relativeTo="PostalAutoCompleteButton4" relativePoint="BOTTOMLEFT"/>
|
<Anchor point="TOPLEFT" relativeTo="postalAutoCompleteButton4" relativePoint="BOTTOMLEFT"/>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
</Button>
|
</Button>
|
||||||
</Frames>
|
</Frames>
|
||||||
@@ -87,13 +87,13 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
POSTAL_AUTOCOMPLETE_MAX_BUTTONS = 5
|
POSTAL_AUTOCOMPLETE_MAX_BUTTONS = 5
|
||||||
this:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b)
|
this:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b)
|
||||||
this:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
|
this:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
|
||||||
this.maxHeight = POSTAL_AUTOCOMPLETE_MAX_BUTTONS * PostalAutoCompleteButton1:GetHeight()
|
this.maxHeight = POSTAL_AUTOCOMPLETE_MAX_BUTTONS * postalAutoCompleteButton1:GetHeight()
|
||||||
PostalAutoCompleteInstructions:SetText("|cffbbbbbbPress Tab|r")
|
postalAutoCompleteInstructions:SetText("|cffbbbbbbPress Tab|r")
|
||||||
</OnLoad>
|
</OnLoad>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
<Button name="PostalAttachment" virtual="true">
|
<Button name="postalAttachment" virtual="true">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="37" y="37"/>
|
<AbsDimension x="37" y="37"/>
|
||||||
</Size>
|
</Size>
|
||||||
@@ -141,13 +141,13 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
this:RegisterForDrag('LeftButton')
|
this:RegisterForDrag('LeftButton')
|
||||||
</OnLoad>
|
</OnLoad>
|
||||||
<OnReceiveDrag>
|
<OnReceiveDrag>
|
||||||
Postal.AttachmentButton_OnClick()
|
postal.AttachmentButton_OnClick()
|
||||||
</OnReceiveDrag>
|
</OnReceiveDrag>
|
||||||
<OnDragStart>
|
<OnDragStart>
|
||||||
Postal.AttachmentButton_OnClick()
|
postal.AttachmentButton_OnClick()
|
||||||
</OnDragStart>
|
</OnDragStart>
|
||||||
<OnClick>
|
<OnClick>
|
||||||
Postal.AttachmentButton_OnClick()
|
postal.AttachmentButton_OnClick()
|
||||||
this:GetScript'OnEnter'()
|
this:GetScript'OnEnter'()
|
||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
@@ -165,25 +165,25 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
|
<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button name="PostalAttachment1" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment1" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment2" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment2" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment3" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment3" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment4" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment4" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment5" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment5" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment6" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment6" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment7" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment7" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment8" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment8" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment9" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment9" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment10" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment10" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment11" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment11" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment12" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment12" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment13" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment13" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment14" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment14" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment15" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment15" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment16" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment16" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment17" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment17" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment18" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment18" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment19" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment19" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment20" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment20" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
<Button name="PostalAttachment21" parent="SendMailFrame" inherits="PostalAttachment"/>
|
<Button name="postalAttachment21" parent="SendMailFrame" inherits="postalAttachment"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user