vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | function SW_SlashCommand(msg) |
||
3 | if msg == nil then return; end |
||
4 | |||
5 | local _,_, c, v = string.find(msg, "([^ ]+) (.+)"); |
||
6 | if c == nil then |
||
7 | c = string.gsub(msg, " ", ""); |
||
8 | end |
||
9 | if c == "" then |
||
10 | SW_PrintHelp(); |
||
11 | return; |
||
12 | end |
||
13 | |||
14 | local cmd = nil; |
||
15 | for k,v in pairs(SW_SlashCommands) do |
||
16 | if v["c"] == c then |
||
17 | cmd = v; |
||
18 | break; |
||
19 | end |
||
20 | end |
||
21 | if cmd == nil then |
||
22 | SW_printStr(SW_CONSOLE_NOCMD .. c); |
||
23 | SW_printStr(SW_CONSOLE_HELP ..SW_RootSlashes[1].." "..SW_SlashCommands["help"]["c"]); |
||
24 | return; |
||
25 | end |
||
26 | |||
27 | if cmd["aC"] > 0 then |
||
28 | if v == nil or string.gsub(v, " ", "") == "" then |
||
29 | SW_printStr(cmd["u"]); |
||
30 | return; |
||
31 | end |
||
32 | cmd["f"](v); |
||
33 | else |
||
34 | cmd["f"](); |
||
35 | end |
||
36 | end |
||
37 | function SW_ResetAllWindows() |
||
38 | SW_BarFrame1:SetPoint("TOPLEFT",UIParent, "CENTER", -50, 50); |
||
39 | SW_BarFrame1:Show(); |
||
40 | SW_TextWindow:SetPoint("TOPLEFT", UIParent, "CENTER"); |
||
41 | SW_GeneralSettings:SetPoint("TOPLEFT",UIParent, "CENTER", 20, -20); |
||
42 | SW_GeneralSettings:Show(); |
||
43 | SW_BarReportFrame:SetPoint("TOPLEFT",UIParent, "CENTER", 40, -40); |
||
44 | SW_BarReportFrame:Show(); |
||
45 | SW_BarSyncFrame:SetPoint("TOPLEFT",UIParent, "CENTER", 60, -60); |
||
46 | SW_BarSyncFrame:Show(); |
||
47 | SW_BarSettingsFrameV2:SetPoint("TOPLEFT",UIParent, "CENTER"); |
||
48 | SW_FrameConsole:SetPoint("TOPLEFT",UIParent, "CENTER"); |
||
49 | |||
50 | end |
||
51 | function SW_ToggleConsole() |
||
52 | local frame = getglobal("SW_FrameConsole") |
||
53 | if( frame:IsVisible() ) then |
||
54 | frame:Hide(); |
||
55 | else |
||
56 | frame:Show(); |
||
57 | end |
||
58 | end |
||
59 | function SW_ToggleBarFrame() |
||
60 | local frame = getglobal("SW_BarFrame1") |
||
61 | if( frame:IsVisible() ) then |
||
62 | SW_Settings["SHOWMAIN"] = nil; |
||
63 | frame:Hide(); |
||
64 | else |
||
65 | SW_Settings["SHOWMAIN"] = true; |
||
66 | frame:Show(); |
||
67 | end |
||
68 | end |
||
69 | function SW_ToggleLocks() |
||
70 | if SW_Settings["BFLocked"] then |
||
71 | SW_LockFrames(); |
||
72 | else |
||
73 | SW_LockFrames(true); |
||
74 | end |
||
75 | end |
||
76 | function SW_ToggleGeneralSettings() |
||
77 | local frame = getglobal("SW_GeneralSettings") |
||
78 | if( frame:IsVisible() ) then |
||
79 | frame:Hide(); |
||
80 | else |
||
81 | frame:Show(); |
||
82 | end |
||
83 | end |
||
84 | function SW_DumpVar(cmdString) |
||
85 | local varName = string.gsub(cmdString, " ", "") |
||
86 | local g = getfenv(); |
||
87 | |||
88 | if g[varName] == nil then |
||
89 | SW_printStr(varName..SW_CONSOLE_NIL_TRAILER); |
||
90 | return; |
||
91 | else |
||
92 | if type(g[varName]) == "table" then |
||
93 | SW_DumpTable(g[varName]); |
||
94 | else |
||
95 | SW_printStr(g[varName]); |
||
96 | end |
||
97 | end |
||
98 | |||
99 | end |
||
100 | function SW_ResetInfo() |
||
101 | SW_S_Details = {}; |
||
102 | SW_S_Healed = {}; |
||
103 | SW_S_SpellInfo = {}; |
||
104 | SW_S_ManaUsage = {}; |
||
105 | SW_S_LastManaSent = {0,0,0}; |
||
106 | SW_CombatTime = 0; |
||
107 | SW_DPS_Dmg =0; |
||
108 | |||
109 | -- 1.5 the new pet systems needs a SW_RebuildFriendList |
||
110 | SW_PetInfo = {}; |
||
111 | SW_PetInfo["OWNER_PET"] = {}; |
||
112 | SW_PetInfo["PET_OWNER"] = {}; |
||
113 | SW_RebuildFriendList(); |
||
114 | |||
115 | --1.5.3 the Raid per second info |
||
116 | SW_RPS = SW_C_RPS:new(); |
||
117 | |||
118 | SW_Sync_MsgTrack = {}; |
||
119 | end |
||
120 | |||
121 | function SW_PostCheck(target) |
||
122 | local id; |
||
123 | if SW_Settings["SYNARP"] then |
||
124 | return true; |
||
125 | end |
||
126 | if UnitInRaid("player") then |
||
127 | if IsRaidLeader() or IsRaidOfficer() then |
||
128 | return true; |
||
129 | else |
||
130 | if target == "RAID" then |
||
131 | return false; |
||
132 | else |
||
133 | return true; |
||
134 | end |
||
135 | end |
||
136 | --[[ hmm i think this is to restrictive |
||
137 | elseif UnitInParty("player") then |
||
138 | if IsPartyLeader() then |
||
139 | return true; |
||
140 | else |
||
141 | if target == "PARTY" then |
||
142 | return false; |
||
143 | else |
||
144 | return true; |
||
145 | end |
||
146 | end |
||
147 | --]] |
||
148 | else |
||
149 | return true; |
||
150 | end |
||
151 | end |
||
152 | |||
153 | function SW_ResetCheck() |
||
154 | local id; |
||
155 | |||
156 | if SW_Settings["SYNCLastChan"] == nil then |
||
157 | StaticPopup_Show("SW_Reset"); |
||
158 | return; |
||
159 | else |
||
160 | -- are we still in this channel? |
||
161 | id, _ = GetChannelName(SW_Settings["SYNCLastChan"]); |
||
162 | if id == 0 then |
||
163 | StaticPopup_Show("SW_Reset"); |
||
164 | return; |
||
165 | else |
||
166 | --here we are in a active syncchan |
||
167 | if UnitInRaid("player") then |
||
168 | if IsRaidLeader() or IsRaidOfficer() then |
||
169 | StaticPopup_Show("SW_ResetSync"); |
||
170 | else |
||
171 | StaticPopup_Show("SW_ResetFailInfo"); |
||
172 | end |
||
173 | else |
||
174 | if IsPartyLeader() then |
||
175 | StaticPopup_Show("SW_ResetSync"); |
||
176 | else |
||
177 | StaticPopup_Show("SW_ResetFailInfo"); |
||
178 | end |
||
179 | end |
||
180 | end |
||
181 | end |
||
182 | end |
||
183 | function SW_RebuildFriendList() |
||
184 | if GetNumRaidMembers() > 0 then |
||
185 | SW_Make_Friends("RAID"); |
||
186 | elseif GetNumPartyMembers() > 0 then |
||
187 | SW_Make_Friends("GROUP"); |
||
188 | else |
||
189 | SW_Make_Friends(); |
||
190 | end |
||
191 | end |
||
192 | |||
193 | function SW_PrintHelp() |
||
194 | local con = getglobal("SW_FrameConsole"); |
||
195 | |||
196 | if con ~= nil and con:IsVisible() then |
||
197 | con = getglobal("SW_FrameConsole_Text1_MsgFrame"); |
||
198 | else |
||
199 | con = DEFAULT_CHAT_FRAME; |
||
200 | end |
||
201 | if con ~= nil then |
||
202 | for k,v in pairs(SW_SlashCommands) do |
||
203 | if v["c"] ~= nil then |
||
204 | if v["si"] ==nil then |
||
205 | con:AddMessage("|cc0c0ff00"..v["c"]..":"); |
||
206 | else |
||
207 | con:AddMessage("|cc0c0ff00"..v["c"]..":"..NORMAL_FONT_COLOR_CODE.." "..v["si"]); |
||
208 | end |
||
209 | if v["u"] ~= nil then |
||
210 | con:AddMessage(NORMAL_FONT_COLOR_CODE.." "..v["u"]); |
||
211 | end |
||
212 | end |
||
213 | end |
||
214 | end |
||
215 | end |
||
216 | function SW_ManualSyncJoin(chanName) |
||
217 | if tonumber(chanName) then |
||
218 | StaticPopup_Show("SW_InvalidChan"); |
||
219 | return; |
||
220 | end |
||
221 | SW_SyncChanID = 0; |
||
222 | SW_SyncQueue:Clear(); |
||
223 | if SW_Settings["SYNCLastChan"] ~= nil then |
||
224 | LeaveChannelByName(SW_Settings["SYNCLastChan"]); |
||
225 | SW_Settings["SYNCLastChan"] = nil; |
||
226 | end |
||
227 | SW_SyncJoin(chanName); |
||
228 | end |
||
229 | |||
230 | function SW_KickPlayer(who) |
||
231 | if UnitInRaid("player") and not (IsRaidLeader() or IsRaidOfficer()) then |
||
232 | return; |
||
233 | end |
||
234 | SW_SendSyncKick(who); |
||
235 | |||
236 | end |
||
237 | function SW_InitResetVote() |
||
238 | if SW_SyncChanID ~= 0 and SW_Settings["SYNCLastChan"] ~= nil then |
||
239 | SW_ResetVote(); |
||
240 | end |
||
241 | end |
||
242 | function SW_VersionCheck() |
||
243 | SW_SyncSendRSV(); |
||
244 | local swc = getglobal("SW_FrameConsole"); |
||
245 | if not swc:IsVisible() then |
||
246 | swc:Show(); |
||
247 | end |
||
248 | end |
||
249 | function SW_GetSkillUsage(cmdString) |
||
250 | SW_SyncSendRSU(cmdString); |
||
251 | local swc = getglobal("SW_FrameConsole"); |
||
252 | if not swc:IsVisible() then |
||
253 | swc:Show(); |
||
254 | end |
||
255 | end |