vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 assert( oRA, "oRA not found!")
2  
3 ------------------------------
4 -- Are you local? --
5 ------------------------------
6  
7 local L = AceLibrary("AceLocale-2.2"):new("oRAPCoolDown")
8 local BS = AceLibrary("Babble-Spell-2.2")
9  
10 ----------------------------
11 -- Localization --
12 ----------------------------
13  
14 L:RegisterTranslations("enUS", function() return {
15 ["cd"] = true,
16 ["cooldown"] = true,
17 ["cooldownparticipant"] = true,
18 ["Options for cooldowns."] = true,
19 ["gain Soulstone Resurrection"] = true,
20 ["gains Soulstone Resurrection"] = true,
21 ["Participant/CoolDown"] = true,
22 } end )
23  
24 L:RegisterTranslations("deDE", function() return {
25 ["gain Soulstone Resurrection"] = "Ihr bekommt 'Seelenstein%-Auferstehung'",
26 ["gains Soulstone Resurrection"] = "bekommt 'Seelenstein%-Auferstehung'",
27 } end )
28  
29 L:RegisterTranslations("frFR", function() return {
30 --["cd"] = true,
31 --["cooldown"] = true,
32 --["cooldownparticipant"] = true,
33 ["Options for cooldowns."] = "Options concernant les temps de recharge.",
34 ["gain Soulstone Resurrection"] = "gagnez R\195\169surrection de Pierre d'\195\162me",
35 ["gains Soulstone Resurrection"] = "gagne R\195\169surrection de Pierre d'\195\162me",
36 ["Participant/CoolDown"] = "Participant/Temps de recharge",
37 } end )
38  
39 L:RegisterTranslations("koKR", function() return {
40  
41 ["Options for cooldowns."] = "재사용대기시간 설정",
42 ["gain Soulstone Resurrection"] = "영혼석 보관 효과를 얻었습니다",
43 ["gains Soulstone Resurrection"] = "님이 영혼석 보관 효과를 얻었습니다",
44 ["Participant/CoolDown"] = "부분/재사용대기시간",
45 } end )
46  
47 L:RegisterTranslations("zhCN", function() return {
48 ["cd"] = "冷却",
49 ["cooldown"] = "冷却",
50 ["cooldownparticipant"] = "cooldownparticipant",
51 ["Options for cooldowns."] = "冷却监视器选项",
52 ["gain Soulstone Resurrection"] = "获得灵魂石",
53 ["gains Soulstone Resurrection"] = "获得灵魂石",
54 ["Participant/CoolDown"] = "Participant/CoolDown",
55 } end )
56  
57 L:RegisterTranslations("zhTW", function() return {
58 ["cd"] = "冷卻",
59 ["cooldown"] = "冷卻",
60 ["cooldownparticipant"] = "cooldownparticipant",
61 ["Options for cooldowns."] = "冷卻監視器選項",
62 ["gain Soulstone Resurrection"] = "獲得靈魂石",
63 ["gains Soulstone Resurrection"] = "獲得靈魂石效果",
64 ["Participant/CoolDown"] = "隊員/冷卻",
65 } end )
66 ----------------------------------
67 -- Module Declaration --
68 ----------------------------------
69  
70 oRAPCoolDown = oRA:NewModule(L["cooldownparticipant"], "AceHook-2.1")
71 oRAPCoolDown.defaults = {
72 }
73 oRAPCoolDown.participant = true
74 oRAPCoolDown.name = L["Participant/CoolDown"]
75 -- oRAPCoolDown.consoleCmd = L["cd"]
76 -- oRAPCoolDown.consoleOptions = {
77 -- type = "group",
78 -- desc = L["Options for cooldowns."],
79 -- args = {
80 -- }
81 -- }
82  
83  
84 ------------------------------
85 -- Initialization --
86 ------------------------------
87  
88 function oRAPCoolDown:OnEnable()
89  
90 self.spell = nil
91 self.sscasting = nil
92 self.rescasting = nil
93  
94 local _, c = UnitClass("player")
95 if c == "DRUID" or c == "WARLOCK" or c == "PALADIN" then
96 self:RegisterEvent("SPELLCAST_START")
97 self:RegisterEvent("SPELLCAST_FAILED", "SpellFailed")
98 self:RegisterEvent("SPELLCAST_INTERRUPTED", "SpellFailed")
99 self:RegisterEvent("SPELLCAST_STOP")
100 if c == "WARLOCK" then
101 self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS", "CheckSoulstone")
102 self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS", "CheckSoulstone")
103 self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_BUFFS", "CheckSoulstone")
104 end
105 elseif c == "SHAMAN" then
106 self:Hook("UseSoulstone", true)
107 end
108 end
109  
110 function oRAPCoolDown:OnDisable()
111 self:UnregisterAllEvents()
112 self:UnhookAll()
113 end
114  
115  
116 -------------------------------
117 -- Event Handlers --
118 -------------------------------
119  
120 function oRAPCoolDown:SPELLCAST_START( arg1 )
121 self.spell = arg1
122 if self.spell == BS["Soulstone Resurrection"] then
123 self.sscasting = true
124 elseif self.spell == BS["Rebirth"] then
125 self.rescasting = true
126 elseif self.spell == BS["Divine Intervention"] then
127 self.rescasting = true
128 end
129 end
130  
131 function oRAPCoolDown:SPELLCAST_STOP( arg1 )
132 if self.spell == BS["Rebirth"] then
133 self.rescasting = nil
134 self.spell = nil
135 self:SendMessage("CD 1 30")
136 elseif self.spell == BS["Divine Intervention"] then
137 self.rescasting = nil
138 self.spell = nil
139 self:SendMessage("CD 4 60", true) -- only oRA2 clients will receive this cooldown I just numbered on.
140 end
141 end
142  
143 function oRAPCoolDown:SpellFailed()
144 if self.spell == BS["Rebirth"] then self.rescasting = nil end
145 if self.spell == BS["Soulstone Resurrection"] then self.sscasting = nil end
146 if self.spell == BS["Divine Intervention"] then self.rescasting = nil end
147 end
148  
149 function oRAPCoolDown:CheckSoulstone( arg1 )
150 if self.sscasting then
151 if string.find(arg1, L["gains Soulstone Resurrection"]) or string.find( arg1, L["gain Soulstone Resurrection"]) then
152 self.spell = nil
153 self.sscasting = nil
154 self:SendMessage("CD 3 30")
155 end
156 end
157 end
158  
159 ---------------
160 -- Hooks --
161 ---------------
162  
163 function oRAPCoolDown:UseSoulstone()
164 local text = HasSoulstone()
165 if text and text == BS["Reincarnation"] then
166 local cooldown = 60
167 for tab = 1, GetNumTalentTabs(), 1 do
168 for talent = 1, GetNumTalents(tab), 1 do
169 local name, _, _, _, rank = GetTalentInfo(tab, talent)
170 if name == BS["Improved Reincarnation"] then
171 cooldown = cooldown - (rank*10)
172 break
173 end
174 end
175 if cooldown then break end
176 self:SendMessage("CD 2 " .. cooldown )
177 end
178 end
179 self.hooks["UseSoulstone"]()
180 end