Language:
Lua     Change language:
Pastebin: 3866
Author: Cide
Subject: Untitled
Created: 2006-12-21 14:12:33
Download and save
Toggle line numbers
1 
2function GMail:ContainerFrameItemButton_OnModifiedClick(...) 
3    if ( (...) == "LeftButton" ) then 
4        local bag, item = this:GetParent():GetID(), this:GetID() 
5        if ( IsAltKeyDown() ) then 
6            if ( GMailFrame:IsVisible() and not CursorHasItem() ) then 
7                if ( ( self:GetItemFrame(bag, item) or ( GMail_addItem and GMail_addItem[1] == bag and GMail_addItem[2] == item ) ) and not special ) then 
8                    return 
9                end 
10                local
11                for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
12                    if ( not getglobal("GMailButton" .. i).item ) then 
13                        if ( self:ItemIsMailable(bag, item) ) then 
14                            GMail:Print(L["GMail: cannot attach item."], 1, 0.5, 0
15                            return 
16                        end 
17                        PickupContainerItem(bag, item) 
18                        self:MailButton_OnClick(getglobal("GMailButton" .. i)) 
19                        self:UpdateItemButtons() 
20                        return 
21                    end 
22                end 
23            elseif ( SendMailFrame:IsVisible() and not CursorHasItem() ) then 
24                PickupContainerItem(bag, item) 
25                ClickSendMailItemButton() 
26                return 
27            elseif ( TradeFrame:IsVisible() and not CursorHasItem() ) then 
28                for i = 1, 6, 1 do 
29                    if ( not GetTradePlayerItemLink(i) ) then 
30                        PickupContainerItem(bag, item) 
31                        ClickTradeButton(i) 
32                        return 
33                    end 
34                end 
35            elseif ( not CursorHasItem() and ( not TradeFrame or not TradeFrame:IsVisible() ) and ( not AuctionFrame or not AuctionFrame:IsVisible() ) and UnitExists("target") and CheckInteractDistance("target", 2) and UnitIsFriend("player", "target") and UnitIsPlayer("target") ) then 
36                InitiateTrade("target"
37                GMail_addItem = { bag, item, UnitName("target"), 2 } 
38                for i = 1, NUM_CONTAINER_FRAMES, 1 do 
39                    if ( getglobal("ContainerFrame" .. i):IsVisible() ) then 
40                        ContainerFrame_Update(getglobal("ContainerFrame" .. i)) 
41                    end 
42                end 
43                return 
44            end 
45        end 
46    end 
47end 
48 
49local oldContainerFrameItemButton_OnModifiedClick = ContainerFrameItemButton_OnModifiedClick; 
50function ContainerFrameItemButton_OnModifiedClick(...) 
51    if ( (...) == "LeftButton" ) then 
52        local bag, item = this:GetParent():GetID(), this:GetID(); 
53        if ( IsAltKeyDown() ) then 
54            if ( CT_MailFrame:IsVisible() and not CursorHasItem() ) then 
55                if ( ( CT_Mail_GetItemFrame(bag, item) or ( CT_Mail_addItem and CT_Mail_addItem[1] == bag and CT_Mail_addItem[2] == item ) ) and not special ) then 
56                    return
57                end 
58                local i; 
59                for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
60                    if ( not getglobal("CT_MailButton" .. i).item ) then 
61 
62                        local canMail = CT_Mail_ItemIsMailable(bag, item); 
63                        if ( canMail ) then 
64                            DEFAULT_CHAT_FRAME:AddMessage("<CTMod> Cannot attach item, item is " .. canMail, 1, 0.5, 0); 
65                            return
66                        end 
67                        PickupContainerItem(bag, item); 
68                        CT_MailButton_OnClick(getglobal("CT_MailButton" .. i)); 
69                        CT_Mail_UpdateItemButtons(); 
70                        return
71                    end 
72                end 
73            elseif ( SendMailFrame:IsVisible() and not CursorHasItem() ) then 
74                PickupContainerItem(bag, item); 
75                ClickSendMailItemButton(); 
76                return
77            elseif ( TradeFrame:IsVisible() and not CursorHasItem() ) then 
78                for i = 1, 6, 1 do 
79                    if ( not GetTradePlayerItemLink(i) ) then 
80                        PickupContainerItem(bag, item); 
81                        ClickTradeButton(i); 
82                        return
83                    end 
84                end 
85            elseif ( not CursorHasItem() and ( not TradeFrame or not TradeFrame:IsVisible() ) and ( not AuctionFrame or not AuctionFrame:IsVisible() ) and UnitExists("target") and CheckInteractDistance("target", 2) and UnitIsFriend("player", "target") and UnitIsPlayer("target") ) then 
86                InitiateTrade("target"); 
87                CT_Mail_addItem = { bag, item, UnitName("target"), 2 }
88                for i = 1, NUM_CONTAINER_FRAMES, 1 do 
89                    if ( getglobal("ContainerFrame" .. i):IsVisible() ) then 
90                        ContainerFrame_Update(getglobal("ContainerFrame" .. i)); 
91                    end 
92                end 
93                return
94            end 
95        end 
96    end 
97    oldContainerFrameItemButton_OnModifiedClick(...); 
98end 
Download and save
Toggle line numbers
Thread:
[3866] Untitled by Cide at 2006-12-21 14:12:33
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.