vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | assert(BigWigs, "BigWigs not found!") |
||
3 | |||
4 | ---------------------------- |
||
5 | -- Localization -- |
||
6 | ---------------------------- |
||
7 | |||
8 | local L = AceLibrary("AceLocale-2.0"):new("BigWigsTranq") |
||
9 | |||
10 | L:RegisterTranslations("enUS", function() return { |
||
11 | CHAT_MSG_SPELL_SELF_BUFF = "You fail to dispel (.+)'s Frenzy.", |
||
12 | CHAT_MSG_SPELL_SELF_DAMAGE = "You cast Tranquilizing Shot on (.+).", |
||
13 | |||
14 | ["Tranq - "] = true, |
||
15 | ["%s's Tranq failed!"] = true, |
||
16 | ["Tranq"] = true, |
||
17 | ["Options for the tranq module."] = true, |
||
18 | ["Toggle tranq bars on or off."] = true, |
||
19 | ["Bars"] = true, |
||
20 | } end) |
||
21 | |||
22 | L:RegisterTranslations("koKR", function() return { |
||
23 | CHAT_MSG_SPELL_SELF_BUFF = "(.+)의 광기|1을;를; 무효화하지 못했습니다.", --"You fail to dispel (.+)'s Frenzy.", |
||
24 | CHAT_MSG_SPELL_SELF_DAMAGE = "(.+).에게 평정의 사격|1을;를; 시전합니다.", --"You cast Tranquilizing Shot on (.+).", |
||
25 | |||
26 | ["Tranq - "] = "평정 - ", |
||
27 | ["%s's Tranq failed!"] = "%s의 평정 실패!", |
||
28 | ["Tranq"] = "평정", |
||
29 | ["Options for the tranq module."] = "평정 모듈에 대한 설정.", |
||
30 | ["Toggle tranq bars on or off."] = "평정바 토글.", |
||
31 | ["Bars"] = "바", |
||
32 | } end) |
||
33 | |||
34 | L:RegisterTranslations("zhCN", function() return { |
||
35 | CHAT_MSG_SPELL_SELF_BUFF = "你未能驱散(.+)的狂乱。", |
||
36 | CHAT_MSG_SPELL_SELF_DAMAGE = "你对(.+)施放了宁神射击。", |
||
37 | |||
38 | ["Tranq - "] = "宁神射击 - ", |
||
39 | ["%s's Tranq failed!"] = "%s的宁神射击失败了!", |
||
40 | } end) |
||
41 | |||
42 | L:RegisterTranslations("deDE", function() return { |
||
43 | CHAT_MSG_SPELL_SELF_BUFF = "(.+) kann dies nicht bannen: Raserei", -- ? |
||
44 | CHAT_MSG_SPELL_SELF_DAMAGE = "Ihr wirkt Einlullender Schuss auf (.+)", |
||
45 | |||
46 | ["Tranq - "] = "Einlullender Schuss - ", |
||
47 | ["%s's Tranq failed!"] = "%s's Einlullender Schuss verfehlt", |
||
48 | } end) |
||
49 | |||
50 | ---------------------------------- |
||
51 | -- Module Declaration -- |
||
52 | ---------------------------------- |
||
53 | |||
54 | BigWigsTranq = BigWigs:NewModule(L["Tranq"]) |
||
55 | BigWigsTranq.revision = tonumber(string.sub("$Revision: 11446 $", 12, -3)) |
||
56 | BigWigsTranq.defaults = { |
||
57 | bars = true, |
||
58 | } |
||
59 | BigWigsTranq.consoleCmd = L["Tranq"] |
||
60 | BigWigsTranq.consoleOptions = { |
||
61 | type = "group", |
||
62 | name = L["Tranq"], |
||
63 | desc = L["Options for the tranq module."], |
||
64 | args = { |
||
65 | [L["Bars"]] = { |
||
66 | type = "toggle", |
||
67 | name = L["Bars"], |
||
68 | desc = L["Toggle tranq bars on or off."], |
||
69 | get = function() return BigWigsTranq.db.profile.bars end, |
||
70 | set = function(v) |
||
71 | BigWigsTranq.db.profile.bars = v |
||
72 | end, |
||
73 | }, |
||
74 | } |
||
75 | } |
||
76 | |||
77 | ------------------------------ |
||
78 | -- Initialization -- |
||
79 | ------------------------------ |
||
80 | |||
81 | function BigWigsTranq:OnEnable() |
||
82 | self:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF") |
||
83 | self:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE") |
||
84 | |||
85 | self:RegisterEvent("BigWigs_RecvSync") |
||
86 | self:RegisterEvent("BigWigs_TranqFired", 5) |
||
87 | self:RegisterEvent("BigWigs_TranqFail", 5) |
||
88 | end |
||
89 | |||
90 | |||
91 | ------------------------------ |
||
92 | -- Event Handlers -- |
||
93 | ------------------------------ |
||
94 | |||
95 | function BigWigsTranq:CHAT_MSG_SPELL_SELF_BUFF(msg) |
||
96 | if not msg then |
||
97 | self:Debug("CHAT_MSG_SPELL_SELF_BUFF: msg is nil") |
||
98 | elseif string.find(msg, L"CHAT_MSG_SPELL_SELF_BUFF") then |
||
99 | self:TriggerEvent("BigWigs_SendSync", "TranqShotFail "..UnitName("player")) |
||
100 | end |
||
101 | end |
||
102 | |||
103 | |||
104 | function BigWigsTranq:CHAT_MSG_SPELL_SELF_DAMAGE(msg) |
||
105 | if not msg then |
||
106 | self:Debug("CHAT_MSG_SPELL_SELF_DAMAGE: msg is nil") |
||
107 | elseif string.find(msg, L"CHAT_MSG_SPELL_SELF_DAMAGE") then |
||
108 | self:TriggerEvent("BigWigs_SendSync", "TranqShotFired "..UnitName("player")) |
||
109 | end |
||
110 | end |
||
111 | |||
112 | |||
113 | function BigWigsTranq:BigWigs_RecvSync(sync, details, sender) |
||
114 | if sync == "TranqShotFired" then self:TriggerEvent("BigWigs_TranqFired", details) |
||
115 | elseif sync == "TranqShotFail" then self:TriggerEvent("BigWigs_TranqFail", details) end |
||
116 | end |
||
117 | |||
118 | |||
119 | function BigWigsTranq:BigWigs_TranqFired(unitname) |
||
120 | if self.db.profile.bars then |
||
121 | self:TriggerEvent("BigWigs_StartBar", self, L["Tranq - "]..unitname, 20, "Interface\\Icons\\Spell_Nature_Drowsy", "Green") |
||
122 | end |
||
123 | end |
||
124 | |||
125 | |||
126 | function BigWigsTranq:BigWigs_TranqFail(unitname) |
||
127 | if self.db.profile.bars then |
||
128 | self:SetCandyBarColor(L["Tranq - "]..unitname, "Red") |
||
129 | self:TriggerEvent("BigWigs_Message", format(L["%s's Tranq failed!"], unitname), "Red", nil, "Alarm") |
||
130 | end |
||
131 | end |