vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 if not SimpleCombatLog then return end
2  
3 local dewdrop = AceLibrary("Dewdrop-2.0")
4  
5 local L = SimpleCombatLog.loc.watch
6  
7 local watchTypes = { "source", "victim", "skill" }
8  
9 function SimpleCombatLog:AddWatch(id, watchType, keyword)
10 if keyword == "%t" then keyword = UnitName('target') end
11  
12 if not keyword or keyword == "" then return end
13 if not self.settings[id] then
14 self.settings[id] = {}
15 self.settingDB[id] = self.settings[id]
16 else
17 if self.settings[id].theme then
18 self.settings[id] = SimpleCombatLog.CopyTable({}, self.settings[id])
19 self.settings[id].theme = nil
20 self.settingDB[id] = self.settings[id]
21 end
22 end
23  
24  
25 if not self.settings[id].watchList then
26 self.settings[id].watchList = {}
27 end
28  
29 if not self.settings[id].watchList[watchType] then
30 self.settings[id].watchList[watchType] = {}
31 end
32  
33 self.settings[id].watchList[watchType][keyword] = true
34 end
35  
36 function SimpleCombatLog:SetWatch(id, watchType, oldKeyword, newKeyword)
37 if newKeyword == "%t" then newKeyword = UnitName('target') end
38 if not newKeyword then return end
39 if newKeyword ~= "" then
40 self.settings[id].watchList[watchType][newKeyword] = true
41 end
42 self.settings[id].watchList[watchType][oldKeyword] = nil
43 end
44  
45 local function UpdateWatchOptionsTable(self, id, level, value)
46 if level == 1 then
47 dewdrop:AddLine(
48 'text', L["Watches"],
49 'tooltipTitle', L["Watches"],
50 'tooltipText', L.tooltip_Watches,
51 'notCheckable', true,
52 'hasArrow', true,
53 'value', 'watch'
54 )
55 elseif level == 2 and value == 'watch' then
56  
57 for i, watchType in pairs(watchTypes) do
58 local watchType = watchType
59 dewdrop:AddLine(
60 'text', L.title[watchType],
61 'isTitle', true,
62 'notCheckable', true
63 )
64 watchList = self:GetWatchList(id, watchType)
65 if watchList then
66 for keyword in pairs(watchList) do
67 local keyword = keyword
68 dewdrop:AddLine(
69 'text', keyword,
70 'hasArrow', true,
71 'notCheckable', true,
72 'hasEditBox', true,
73 'editBoxText', keyword,
74 'editBoxFunc', function(text) self:SetWatch(id, watchType, keyword, text) end
75 )
76 end
77 end
78 dewdrop:AddLine(
79 'text', L.add[watchType],
80 'tooltipTitle', L.add[watchType],
81 'tooltipText', L.tooltip[watchType],
82 'hasArrow', true,
83 'notCheckable', true,
84 'hasEditBox', true,
85 'editBoxFunc', function(text) self:AddWatch(id, watchType, text) end
86 )
87 end
88 end
89 end
90  
91 if SimpleCombatLog.menuFunc then
92 SimpleCombatLog.menuFunc[5] = UpdateWatchOptionsTable
93 end