vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | Quutar: |
2 | |||
3 | |||
4 | To determine what pet is out: |
||
5 | |||
6 | First check if we are a Warlock (probably on Init). |
||
7 | |||
8 | On press, check: |
||
9 | |||
10 | if (UnitCreatureFamily("pet") == ServitudeLocalization.Pet4) then |
||
11 | |||
12 | You might also want to check if the pet is a Doomguard and use Dispel Magic for that one. |
||
13 | |||
14 | |||
15 | In my Localization file (not sure if Decursive works for French and German clients like Servitude did). |
||
16 | |||
17 | |||
18 | |||
19 | |||
20 | if (GetLocale() == "frFR") then |
||
21 | |||
22 | ServitudeLocalization = |
||
23 | |||
24 | { |
||
25 | |||
26 | Class = "D\195\169moniste"; |
||
27 | |||
28 | |||
29 | |||
30 | Pet4 = "Felhunter"; |
||
31 | |||
32 | Pet5 = "Doomguard"; |
||
33 | |||
34 | |||
35 | |||
36 | Magic5 = "Festin magique"; |
||
37 | |||
38 | |||
39 | |||
40 | Magic10 = "Dissiper Magie"; |
||
41 | |||
42 | |||
43 | |||
44 | Buff11 = "Parano\195\175a"; |
||
45 | |||
46 | Bufftype = "Magie"; |
||
47 | |||
48 | |||
49 | |||
50 | } |
||
51 | |||
52 | elseif (GetLocale() == "deDE") then |
||
53 | |||
54 | ServitudeLocalization = |
||
55 | |||
56 | { |
||
57 | |||
58 | Class = "Hexenmeister"; |
||
59 | |||
60 | |||
61 | |||
62 | Pet4 = "Teufelsjäger"; |
||
63 | |||
64 | Pet5 = "Doomguard"; |
||
65 | |||
66 | |||
67 | |||
68 | Magic5 = "Magie verschlingen"; |
||
69 | |||
70 | |||
71 | |||
72 | Magic10 = "Magiebannung"; |
||
73 | |||
74 | |||
75 | |||
76 | Buff11 = "Paranoia"; |
||
77 | |||
78 | Bufftype = "Magie"; |
||
79 | |||
80 | |||
81 | } |
||
82 | |||
83 | else |
||
84 | |||
85 | ServitudeLocalization = |
||
86 | |||
87 | { |
||
88 | |||
89 | Class = "Warlock"; |
||
90 | |||
91 | |||
92 | |||
93 | Pet4 = "Felhunter"; |
||
94 | |||
95 | Pet5 = "Doomguard"; |
||
96 | |||
97 | |||
98 | |||
99 | Magic5 = "Devour Magic"; |
||
100 | |||
101 | |||
102 | |||
103 | Magic10 = "Dispel Magic"; |
||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | Buff11 = "Paranoia"; |
||
110 | |||
111 | Bufftype = "Magic"; |
||
112 | |||
113 | |||
114 | |||
115 | } |
||
116 | |||
117 | end |
||
118 | |||
119 | |||
120 | |||
121 | |||
122 | What I did was when PetActionBar_Update occured, I built an Array that put the Pet Action slots in with it's name. I then called that action by name from the array and it returned the slot.. |
||
123 | |||
124 | ie |
||
125 | |||
126 | |||
127 | function Servitude_PetActionBar_Update() |
||
128 | |||
129 | -- Call original function |
||
130 | |||
131 | Original_PetActionBar_Update(); |
||
132 | |||
133 | local DebugMsg = false; |
||
134 | |||
135 | Pet_Action_List = {}; |
||
136 | |||
137 | -- Find the #&%&on, apply the autocast |
||
138 | |||
139 | local i; |
||
140 | |||
141 | for i=1, NUM_PET_ACTION_SLOTS, 1 do |
||
142 | |||
143 | local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i); |
||
144 | |||
145 | if name ~= nil then |
||
146 | |||
147 | if (not PetBarLoaded) then |
||
148 | |||
149 | PetBarLoaded = true; |
||
150 | |||
151 | end |
||
152 | |||
153 | Pet_Action_List[name] = i; |
||
154 | |||
155 | ServitudeMessage(DebugMsg, "Pet_Action_List: added "..name.."as index "..i); |
||
156 | |||
157 | else return |
||
158 | |||
159 | end |
||
160 | |||
161 | end |
||
162 | |||
163 | end |
||
164 | |||
165 | |||
166 | |||
167 | |||
168 | This allowed you to CastPetActionByName(ServitudeLocalization.Magic5) which would check the cooldown prior to use. Since this is only happening on the press of a #&%&on, you could check the cooldown at the time of the press too: |
||
169 | |||
170 | |||
171 | function CastPetActionByName (inputname) |
||
172 | |||
173 | if IsPlayerMounted() or (not GetPetActionsUsable()) then |
||
174 | |||
175 | -- if (not GetPetActionsUsable()) then |
||
176 | |||
177 | return; |
||
178 | |||
179 | end |
||
180 | |||
181 | if Pet_Action_List[inputname] ~= nil then |
||
182 | |||
183 | local startTime, duration, enabled = GetPetActionCooldown(Pet_Action_List[inputname]); |
||
184 | |||
185 | if startTime == 0 and duration == 0 and enabled ~= 0 then |
||
186 | |||
187 | CastPetAction(Pet_Action_List[inputname]); |
||
188 | |||
189 | end |
||
190 | |||
191 | else |
||
192 | |||
193 | local i; |
||
194 | |||
195 | Pet_Action_List = {}; |
||
196 | |||
197 | for i=1, NUM_PET_ACTION_SLOTS, 1 do |
||
198 | |||
199 | local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i); |
||
200 | |||
201 | if name ~= nil then |
||
202 | |||
203 | Pet_Action_List[name] = i; |
||
204 | |||
205 | end |
||
206 | |||
207 | if (name == inputname) then |
||
208 | |||
209 | local startTime, duration, enabled = GetPetActionCooldown(i); |
||
210 | |||
211 | if startTime == 0 and duration == 0 and enabled ~= 0 then |
||
212 | |||
213 | CastPetAction(i); |
||
214 | |||
215 | end |
||
216 | |||
217 | end |
||
218 | |||
219 | end |
||
220 | |||
221 | end |
||
222 | |||
223 | end |
||
224 | |||
225 | |||
226 | |||
227 | |||
228 | EDIT: I've trimmed out things like Making pet actions auto-castable. Next patch, you only need to check GetPetActionsUsable - it now returns false if mounted. |
||
229 | |||
230 | [ post edited by Graguk ] |
||
231 | |||
232 | |||
233 | if (PetBarLoaded and not PetSpellsInitialized) then |
||
234 | |||
235 | Build_Pet_Action_List(); |
||
236 | |||
237 | return; |
||
238 | |||
239 | end |
||
240 | |||
241 | |||
242 | |||
243 | and |
||
244 | |||
245 | |||
246 | function Build_Pet_Action_List() |
||
247 | |||
248 | local i; |
||
249 | |||
250 | Pet_Action_List = {}; |
||
251 | |||
252 | for i=1, NUM_PET_ACTION_SLOTS, 1 do |
||
253 | |||
254 | local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i); |
||
255 | |||
256 | if name ~= nil then |
||
257 | |||
258 | Pet_Action_List[name] = i; |
||
259 | |||
260 | if not PetSpellsInitialized then |
||
261 | |||
262 | PetSpellsInitialized = true; |
||
263 | |||
264 | end |
||
265 | |||
266 | end |
||
267 | |||
268 | end |
||
269 | |||
270 | end |
||
271 | |||
272 | |||
273 | |||
274 | |||
275 | On the UNIT_PET event if it's the player: |
||
276 | |||
277 | |||
278 | |||
279 | elseif (event == "UNIT_PET" and arg1 == "player") then |
||
280 | |||
281 | PetBarLoaded = false; |
||
282 | |||
283 | PetSpellsInitialized = false; |
||
284 | |||
285 | end |