vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 CT_PlayerNotes = { };
2 CT_IgnoreNotes = { };
3 CT_GuildNotes = { };
4  
5 function CT_Notes_Save(frame)
6 -- Choose which table to use
7 local table;
8 if ( frame.type == "ignore" ) then
9 table = CT_IgnoreNotes;
10 elseif ( frame.type == "guild" ) then
11 table = CT_GuildNotes;
12 else
13 table = CT_PlayerNotes;
14 end
15  
16 local button = getglobal("CT_" .. strupper(strsub(frame.type, 1, 1)) .. strsub(frame.type, 2) .. "NotesButton" .. frame.id);
17 local eb = getglobal(frame:GetName() .. "NoteEB");
18 if ( strlen(eb:GetText()) > 0 ) then
19 table[frame.name] = eb:GetText();
20 getglobal(button:GetName() .. "NormalTexture"):SetVertexColor(1.0, 1.0, 1.0);
21 else
22 table[frame.name] = nil;
23 getglobal(button:GetName() .. "NormalTexture"):SetVertexColor(0.5, 0.5, 0.5);
24 end
25 button.note = eb:GetText();
26 eb:SetText("");
27 frame:Hide();
28 end
29  
30 CT_oldFriendsList_Update = FriendsList_Update;
31  
32 function CT_newFriendsList_Update()
33 CT_oldFriendsList_Update();
34 local friendOffset = FauxScrollFrame_GetOffset(FriendsFrameFriendsScrollFrame);
35 local friendIndex;
36 for i=1, FRIENDS_TO_DISPLAY, 1 do
37 friendIndex = friendOffset + i;
38 name = GetFriendInfo(friendIndex);
39 local btn = getglobal("CT_FriendNotesButton" .. i);
40 if ( CT_PlayerNotes[name] ) then
41 btn.note = CT_PlayerNotes[name];
42 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(1.0, 1.0, 1.0);
43 else
44 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(0.5, 0.5, 0.5);
45 btn.note = "";
46 end
47 btn.type = "friend";
48 btn.name = name;
49 end
50 end
51  
52 FriendsList_Update = CT_newFriendsList_Update;
53  
54 CT_oldIgnoreList_Update = IgnoreList_Update;
55  
56 function CT_newIgnoreList_Update()
57 CT_oldIgnoreList_Update();
58 local ignoreOffset = FauxScrollFrame_GetOffset(FriendsFrameIgnoreScrollFrame);
59 local ignoreIndex, name;
60  
61 for i=1, IGNORES_TO_DISPLAY, 1 do
62 ignoreIndex = i + ignoreOffset;
63 name = GetIgnoreName(ignoreIndex);
64 local btn = getglobal("CT_IgnoreNotesButton" .. i);
65 if ( CT_IgnoreNotes[name] ) then
66 btn.note = CT_IgnoreNotes[name];
67 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(1.0, 1.0, 1.0);
68 else
69 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(0.5, 0.5, 0.5);
70 btn.note = "";
71 end
72 btn.type = "ignore";
73 btn.name = name;
74 end
75 end
76  
77 IgnoreList_Update = CT_newIgnoreList_Update;
78  
79 CT_oldGuildStatus_Update = GuildStatus_Update;
80  
81 function CT_newGuildStatus_Update()
82 CT_oldGuildStatus_Update();
83 local guildOffset = FauxScrollFrame_GetOffset(GuildListScrollFrame);
84 local guildIndex, name;
85 local numGuildMembers = GetNumGuildMembers();
86 for i=1, GUILDMEMBERS_TO_DISPLAY, 1 do
87 guildIndex = guildOffset + i;
88 name = GetGuildRosterInfo(guildIndex);
89 local btn = getglobal("CT_GuildNotesButton" .. i);
90 if ( btn ) then
91 btn:ClearAllPoints();
92 local relTo = "GuildFrameButton" .. i;
93 if ( FriendsFrame.playerStatusFrame ) then
94 relTo = "GuildFrameGuildStatusButton" .. i;
95 end
96 if ( numGuildMembers > GUILDMEMBERS_TO_DISPLAY ) then
97 -- Scroll
98 btn:SetPoint("RIGHT", relTo, "LEFT", 295, 0);
99 else
100 -- No scroll
101 btn:SetPoint("RIGHT", relTo, "LEFT", 320, 0);
102 end
103 if ( i > numGuildMembers ) then
104 btn:Hide();
105 else
106 btn:Show();
107 end
108 if ( CT_GuildNotes[name] ) then
109 btn.note = CT_GuildNotes[name];
110 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(1.0, 1.0, 1.0);
111 else
112 getglobal(btn:GetName() .. "NormalTexture"):SetVertexColor(0.5, 0.5, 0.5);
113 btn.note = "";
114 end
115 btn.type = "ignore";
116 btn.type = "guild";
117 btn.name = name;
118 end
119 end
120 end
121  
122 GuildStatus_Update = CT_newGuildStatus_Update;
123  
124 function CT_PlayerNotes_EditingFrame_OnShow()
125 local name;
126 if ( this.type == "ignore" ) then
127 name = "|c00FF0000" .. this.name .. "|r";
128 elseif ( this.type == "guild" ) then
129 name = "|c00FFFF00" .. this.name .. "|r";
130 else
131 name = "|c0000FF00" .. this.name .. "|r";
132 end
133 getglobal(this:GetName() .. "Editing"):SetText(format(CT_PLAYERNOTES_EDITING, name));
134 getglobal(this:GetName() .. "NoteEB"):SetText(this.note);
135 PlaySound("UChatScrollButton");
136 end