vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 assert(BigWigs, "BigWigs not found!")
2  
3 ------------------------------
4 -- Are you local? --
5 ------------------------------
6  
7 local L = AceLibrary("AceLocale-2.0"):new("BigWigsRaidIcon")
8 local lastplayer = nil
9  
10 ----------------------------
11 -- Localization --
12 ----------------------------
13  
14 L:RegisterTranslations("enUS", function() return {
15 ["Raid Icons"] = true,
16  
17 ["raidicon"] = true,
18 ["place"] = true,
19 ["icon"] = true,
20  
21 ["Place"] = true,
22 ["Place Raid Icons"] = true,
23 ["Toggle placing of Raid Icons on players."] = true,
24  
25 ["Icon"] = true,
26 ["Set Icon"] = true,
27 ["Set which icon to place on players."] = true,
28  
29 ["Options for Raid Icons."] = true,
30  
31 ["star"] = true,
32 ["circle"] = true,
33 ["diamond"] = true,
34 ["triangle"] = true,
35 ["moon"] = true,
36 ["square"] = true,
37 ["cross"] = true,
38 ["skull"] = true,
39 } end )
40  
41 L:RegisterTranslations("koKR", function() return {
42 ["Raid Icons"] = "공격대 아이콘",
43  
44 ["Place"] = "지정",
45 ["Place Raid Icons"] = "공격대 아이콘 지정",
46 ["Toggle placing of Raid Icons on players."] = "플레이어에 공격대 아이콘 지정 토글",
47  
48 ["Icon"] = "아이콘",
49 ["Set Icon"] = "아이콘 설정",
50 ["Set which icon to place on players."] = "플레이어에 아이콘 지정을 위한 설정",
51  
52 ["Options for Raid Icons."] = "공격대 아이콘에 대한 설정",
53  
54 ["star"] = "별",
55 ["circle"] = "원",
56 ["diamond"] = "다이아몬드",
57 ["triangle"] = "세모",
58 ["moon"] = "달",
59 ["square"] = "네모",
60 ["cross"] = "가위표",
61 ["skull"] = "해골",
62  
63 } end )
64  
65 L:RegisterTranslations("zhCN", function() return {
66 ["Raid Icons"] = "团队图标",
67  
68 ["Place"] = "标记",
69 ["Place Raid Icons"] = "标记团队图标",
70 ["Toggle placing of Raid Icons on players."] = "切换是否在玩家身上标记团队图标",
71  
72 ["Icon"] = "图标",
73 ["Set Icon"] = "设置图标",
74 ["Set which icon to place on players."] = "设置玩家身上标记的图标。",
75  
76 ["Options for Raid Icons."] = "团队图标设置",
77  
78 ["star"] = "星星",
79 ["circle"] = "圆圈",
80 ["diamond"] = "钻石",
81 ["triangle"] = "三角",
82 ["moon"] = "月亮",
83 ["square"] = "方形",
84 ["cross"] = "十字",
85 ["skull"] = "骷髅",
86 } end )
87  
88 L:RegisterTranslations("deDE", function() return {
89 ["Raid Icons"] = "Schlachtzug Symbole",
90  
91 -- ["raidicon"] = true,
92 -- ["place"] = true,
93 -- ["icon"] = true,
94  
95 ["Place"] = "Platzierung",
96 ["Place Raid Icons"] = "Platziere Schlachtzug Symbole",
97 ["Toggle placing of Raid Icons on players."] = "W\195\164hle, ob Schlachtzug Symbole auf Spieler gesetzt werden.",
98  
99 ["Icon"] = "Symbol",
100 ["Set Icon"] = "Symbol",
101 ["Set which icon to place on players."] = "W\195\164hle, welches Symbol auf Spieler gesetzt wird.",
102  
103 ["Options for Raid Icons."] = "Optionen f\195\188r Schlachtzug Symbole.",
104  
105 ["star"] = "Stern",
106 ["circle"] = "Kreis",
107 ["diamond"] = "Diamant",
108 ["triangle"] = "Dreieck",
109 ["moon"] = "Mond",
110 ["square"] = "Quadrat",
111 ["cross"] = "Kreuz",
112 ["skull"] = "Totenkopf",
113 } end )
114  
115 ----------------------------------
116 -- Module Declaration --
117 ----------------------------------
118  
119 BigWigsRaidIcon = BigWigs:NewModule(L["Raid Icons"])
120 BigWigsRaidIcon.defaultDB = {
121 place = true,
122 icon = L["skull"],
123 }
124 BigWigsRaidIcon.icontonumber = {
125 [L["star"]] = 1,
126 [L["circle"]] = 2,
127 [L["diamond"]] = 3,
128 [L["triangle"]] = 4,
129 [L["moon"]] = 5,
130 [L["square"]] = 6,
131 [L["cross"]] = 7,
132 [L["skull"]] = 8,
133 }
134 BigWigsRaidIcon.consoleCmd = L["raidicon"]
135 BigWigsRaidIcon.consoleOptions = {
136 type = "group",
137 name = L["Raid Icons"],
138 desc = L["Options for Raid Icons."],
139 args = {
140 [L["place"]] = {
141 type = "toggle",
142 name = L["Place Raid Icons"],
143 desc = L["Toggle placing of Raid Icons on players."],
144 get = function() return BigWigsRaidIcon.db.profile.place end,
145 set = function(v) BigWigsRaidIcon.db.profile.place = v end,
146 },
147 [L["icon"]] = {
148 type = "text",
149 name = L["Set Icon"],
150 desc = L["Set which icon to place on players."],
151 get = function() return BigWigsRaidIcon.db.profile.icon end,
152 set = function(v) BigWigsRaidIcon.db.profile.icon = v end,
153 validate = {L["star"], L["circle"], L["diamond"], L["triangle"], L["moon"], L["square"], L["cross"], L["skull"] },
154 },
155 }
156 }
157  
158 ------------------------------
159 -- Initialization --
160 ------------------------------
161  
162 function BigWigsRaidIcon:OnEnable()
163 self:RegisterEvent("BigWigs_SetRaidIcon")
164 self:RegisterEvent("BigWigs_RemoveRaidIcon")
165 end
166  
167 function BigWigsRaidIcon:BigWigs_SetRaidIcon(player)
168 if not self.db.profile.place or not player then return end
169 local icon = self.db.profile.icon
170 if not self.icontonumber[icon] then
171 icon = L["skull"]
172 end
173 icon = self.icontonumber[icon]
174 for i=1,GetNumRaidMembers() do
175 if UnitName("raid"..i) == player then
176 if not GetRaidTargetIndex("raid"..i) then
177 SetRaidTargetIcon("raid"..i, icon)
178 lastplayer = player
179 end
180 end
181 end
182 end
183  
184 function BigWigsRaidIcon:BigWigs_RemoveRaidIcon()
185 if not self.db.profile.place or not lastplayer then return end
186 for i=1,GetNumRaidMembers() do
187 if UnitName("raid"..i) == lastplayer then
188 SetRaidTargetIcon("raid"..i, 0)
189 end
190 end
191 lastplayer = nil
192 end