vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2  
3 HunterPetSkills: Search an in-game database to find where the pet
4 skill and rank you need is located. Type << /petskills >> for
5 a list of commands. copyright 2005 by Jake Bolton (ninmonkey) ninmonkeys@gmail.com
6  
7 Author: Jake Bolton (ninmonkey) email: ninmonkeys@gmail.com
8 (if you have any problems, or features you want added, email me)
9  
10 Usage:
11 Type << /sk >> or << /petskills >> or << /hunterpetskills >>
12 for a list of commands
13  
14 Examples:
15 see the "HunterPetSkills_readme.txt" for examples and more
16 details on the mod usage
17  
18 LastUpdate: 6/28/2005 (this isn't that accurate :P )
19  
20 Thanks To:
21 -John Ruben (Tulas), for helping improve the pet skill
22 descriptions, and ideas for the mod in general.
23  
24 -I started with base info from The Good Intentions Guild
25 ( http://www.goodintentionsguild.info ), then updated my
26 database with current info from hunters (ie: tulas) You can
27 view the guilds pet page at: http://www.goodintentionsguild.info/hunters.html
28  
29 Version 0.2.1 (not made yet)
30  
31 -(todo) see todo for a list of what to do (ie: focus amount)
32 -(todo) find levels for (?) beasts
33 -(todo) change error when bad input for /sk <skill> <rank> <zone>
34 -if zone does not match, output zone not found
35 -allow partial zone name match
36  
37  
38 Version 0.2.0 (Current Version)
39 -updated TOC to version 1500 for blizzard patch
40 -added skill sprint
41 -added skill dive
42 -"skill" is optional, meaning you can type "/sk bite 1" or "/sk skill bite 1"
43 -added ingame help to show sprint/dive are availible skills
44 -updated readme
45 -help output shows "skill" is optional by using brackets: "[skill]", as well as in the readme
46  
47 Version 0.1.3
48 -updated for new blizz patch was 4216 for 1300
49  
50 Version 0.1.2:
51 -updated interface number for blizzard's patch
52 -colored help
53 -cleaned up and shortened skill output
54 -skill output is colored
55  
56 Version 0.1.1:
57 -new command shortcut /sk (/hunterpetskills, /petskills, or /sk all work)
58 -strings changed in bite, claw, and cower
59  
60 (for full changelog, view readme)
61  
62 todo:
63 -append to skill description focus etc? Or a special command
64 that lists all skills with the tooltips?
65  
66 -skill list to append:
67 -bite: 35 focus, instant, 10 seconds cooldown,
68 range 5 yards
69 -claw: 25 focus, instant, 5 yard range
70 -dash: 20 focus, instant, 30 seconds cooldown
71 -dive: 20 focus, instant, 30 seconds cooldown
72 -growl:15 focus, instant, 5 seconds cooldown,
73 5 yard range
74  
75 -append who can learn what:
76  
77 -bite: cannot be learned by:
78 -crabs, scorpids, or owls
79  
80 -claw: cannot be learned by:
81 -bats, boars, crocolisks, gorillas,
82 hyenas, spiders, tall striders,
83 turtles, wind serpents, or
84 wolves/worgs
85  
86 -cower: can be learned by all
87 -growl: can be learned by all
88  
89 -dash: cannot be learned by:
90 -bears, crabs, crocolisks, gorillas,
91 raptors, scorpids, spiders,
92 turtles, or any flying beast
93  
94 -dive: cannot be learned by:
95 -any land-based beast
96  
97 -fix /sk <skill_name> <skill_rank>
98  
99 -pet families
100 -petFamilyArray
101 -1 = claw, 2 = bite, 3 = both
102 -show which families can/cannot learn claw/bite/sprint/dive
103 -possible search, else output families
104 -example:
105 -cat: skill1, skill2, skill3
106 -turtle: skill1, skill2
107 -raptor: skill1, skill2, skill3, skill4
108  
109 -if search without zone name, first do a search with current zone name,
110 if no results, then search all zones (save user time and typing)
111  
112 -disable if not hunter
113 -- set pet arrays to nil?
114 -- don't register events?
115  
116 -- do anything else?
117  
118  
119 notes:
120 -ToQuit
121 -- local playerClass = UnitClass("player"); -- mage, warrior, etc..
122  
123 -for pet stats
124 -- curXP, nextXP = GetPetExperience();
125 -- creatureFamily = UnitCreatureFamily(unit);
126 -- returns creature family, eg: bear, cat, crab, etc...
127  
128 Coming soon:
129 -View pet families
130 -View pet families that can only learn claw
131 -View pet families that can only learn bite
132 -View pet families that can learn all skills
133  
134  
135 ]]
136  
137 -----------------------------------
138 -- variables
139 -----------------------------------
140  
141 -- mod version
142 HUNTERPETSKILLS_MOD_VERSION = "0.2.0";
143 HUNTERPETSKILLS_MOD_NAME = "|cffffff00HunterPetSkills "..HUNTERPETSKILLS_MOD_VERSION.."|r";
144  
145 -- console command list
146 HUNTERPETSKILLS_COMMANDS = { help="help", skill="skill" };
147  
148 HUNTERPETSKILLS_COLOR = { zone="447cbf", help="447cbf", helpheader="099779" };
149  
150 -- displayed at /sk help -- "HunterPetSkills Help:",
151 HUNTERPETSKILLS_HELP_TEXT = {
152 HUNTERPETSKILLS_MOD_NAME.." Help:",
153 HUNTERPETSKILLS_COMMANDS["help"]..": Shows this help file.",
154 "["..HUNTERPETSKILLS_COMMANDS["skill"].."] <skill_name> <skill_rank> [<zone>]: Lists beasts that have <skill_name>(bite|claw|growl|cower|dash|dive) with rank <skill_rank>(0-8). Optionally can try to search a zone.",
155 };
156  
157 -- skill arrays
158  
159 -- bite: rank = description, pet level, locations {zone_name=beast_list,
160 -- zone_name2=beast_list2,..}
161  
162  
163  
164 local HUNTERPETSKILLS_DATA_BITE = {
165 [1] = {"Bite the enemy, causing 9 to 11 damage", 1, locations = {
166 DunMorogh="Snow Tracker Wolf (5-7), Winter Wolf (6-8)",
167 Durotar="Dreadmaw Crocolisk (9-11)",
168 Mulgore="Prairie Wolf (5-6)",
169 Teldrassil="Webwood Venomfang (7-8)"
170 }},
171  
172 [2] = {"Bite the enemy, causing 16 to 18 damage", 8, locations = {
173 Barrens="Echeyakee (16), Savannah Huntress(12-13), Savannah Prowler(14-15), Oasis Snapjaw (15-16)",
174 DunMorogh="Starving Winter Wolf (8-9), Timber (10)",
175 ElwynnForest="Mother Fang (10), Prowler (9-10)",
176 LochModan="Forest Lurker (13-14), Loch Crocolisk (14-15)",
177 Mulgore="Prairie Wolf Alpha (9-10)",
178 RedridgeMountains="Tarantula (15-16)",
179 Teldrassil="Giant Webwood Spider (10-11), Lady Sathrah (12), Webwood Silkspinner (8-9)",
180 TirisfalGlades="Worg (10-11)",
181 Westfall="Coyote Packleader (11-12)"
182 }},
183  
184 [3] = {"Bite the enemy, causing 24 to 28 damage", 16, locations = {
185 Ashenvale="Ghost Paw Runner (19-20)",
186 Duskwood="Green Recluse (21)",
187 HillsbradFoothills="Forest Moss Creeper (20-21)",
188 LochModan="Wood Lurker (17-18)",
189 Redridge="Greater Tarantula (19-20)",
190 SilverpineForest="Bloodsnout Worg (16-17)",
191 StonetalonMountains="Besseleth (21+)",
192 WailingCaverns="Deviate Crocolisk (18+-19+)"
193 }},
194  
195 [4] = {"Bite the enemy, causing 31 to 37 damage", 24, locations = {
196 Ashenvale="Ghostpaw Alpha (27-28)",
197 BlackfathomDeep="Ghamoo-Ra(25+)",
198 Duskwood="Black Mastiff (25-26), Black Ravager (24-25), Naraxis(27)",
199 HillsbradFoothills="Giant Moss Creeper (24), Elder Moss Creeper (27), Snapjaw (30)",
200 Wetlands="Giant Wetlands Crocolisk(25-26)"
201 }},
202  
203 [5] = {"Bite the enemy, causing 40 to 48 damage", 32, locations = {
204 ArathiHighlands="Giant Plains Creeper(35-36), Plains Creeper (32-33)",
205 Badlands="Crag Coyote (35-36)",
206 DustwallowMarsh="Darkfang Lurker (36-37), Drywallow Crocolisk (35-36), Mudrock Tortoise (36-37)",
207 ThousandNeedles="Sparkleshell Snapper (34-35)"
208 }},
209  
210 [6] = {"Bite the enemy, causing 49 to 59 damage", 40, locations = {
211 Felwood="Felpaw Wolf (47-48)",
212 Feralas="Longtooth Runner (40-41), Snarler (42), Wolves (41, 47)",
213 Hinterlands="Witherbark Broodguard (44-45)",
214 SwampOfSorrows="Deathstrike Tarantula (40-41)"
215 }},
216  
217 [7] = {"Bite the enemy, causing 66 to 80 damage", 48, locations = {
218 Felwood="Felpaw Ravager (51-52)",
219 Hinterlands="Saltwater Snapjaw (49-50), Vilebranch Raiding Wolf (51+-52+)",
220 Stormwind="Sewer Beast (50+)",
221 WesternPlagueland="Diseased Wolf(53-54), Plague Lurker (54-55)"
222 }},
223  
224 [8] = {"Bite the enemy, causing 81 to 99 damage", 56, locations = {
225 BlackrockSpires="Bloodaxe Warg (56-57) - spawns near Halycon"
226 }},
227  
228 };
229  
230 -- claw: rank = description, pet level, locations {zone_name=beast_list,
231 -- zone_name2=beast_list2,..}
232  
233 local HUNTERPETSKILLS_DATA_CLAW = {
234 [1] = {"Claw the enemy, causing 4 to 6 damage", 1, locations = {
235 DunMorogh="Ice Claw Bear (7-8)",
236 Durotar="Pygmy Surf Crawler (5-6), Scorpid Workers (3)",
237 Teldrassil="Strigid Owl (5-6)"
238 }},
239  
240 [2] = {"Claw the enemy, causing 8 to 12 damage", 8, locations = {
241 Darkshore="Thistle Bear (11-12)",
242 DunMorogh="Bjarn (12), Mangeclaw (11)",
243 Durotar="Death Flayer (11), Encrusted Surf Crawler (9-10), Venomtail Scorpid (9-10)",
244 ElwynnForest="Young Forest Bear (8-9)",
245 SilverpineForest="Giant Grizzled Bear (12-13)",
246 Teldrassil="Strigid Hunter (8-9)"
247 }},
248  
249 [3] = {"Claw the enemy, causing 12 to 16 damage", 16, locations = {
250 Ashenvale="Ashenvale Bear (21-22), Clattering Crawler (19-20)",
251 Darkshore="Den Mother (19)",
252 HillsbradFoothills="Gray Bear (21-22)",
253 LochModan="Black Bear Patriarch (16-17), Ol' Sooty (20+)",
254 Westfall="Shore Crawler (17-18)"
255 }},
256  
257 [4] = {"Claw the enemy, causing 16 to 22 damage", 24, locations = {
258 Ashenvale="Elder Ashenvale Bear (25-26)",
259 Desolace="Scorpashi Snapper (30-31)",
260 ThousandNeedles="Scorpid Reaver(31-32)"
261 }},
262  
263 [5] = {"Claw the enemy, causing 21 to 29 damage", 32, locations = {
264 Desolace="Scorpashi Lasher (34-35)"
265 }},
266  
267 [6] = {"Claw the enemy, causing 26 to 36 damage", 40, locations = {
268 Feralas="Ironfur Bear (41-42)",
269 SwampOfSorrows="Silt Crawler (40-41)",
270 Tanaris="Scorpid Hunter (40-41)"
271 }},
272  
273 [7] = {"Claw the enemy, causing 35 to 49 damage", 48, locations = {
274 BurningSteppes="Deathlash Scorpid (54-55)",
275 Felwood="Angerclaw Mauler (49-50), Ironbeak Hunter (50-51)",
276 Feralas="Ironfur Patriarch (48-49)",
277 Winterspring="Shardtooth Bear (53-55), Winterspring Owl (54-56)"
278 }},
279  
280 [8] = {"Claw the enemy, causing 43 to 59 damage", 56, locations = {
281 WesternPlaguelands="Diseased Grizzly (55-56)",
282 Winterspring="Elder Shardtooth (57-58), Winterspring Screecher (57-59)"
283 }}
284 };
285  
286 -- cower: rank = pet level, locations {zone_name=beast_list,
287 -- zone_name2=beast_list2,..}
288  
289 local HUNTERPETSKILLS_DATA_COWER = {
290 [1] = {5, locations = {
291 Barrens="Elder Plainstrider (8-9), Fleeting Plainstrider (12-13)",
292 Darkshore="Foreststrider Fledging (11-13), Moonstalker Runt (10-11)",
293 DunMorogh="Juvenile Snow Leopard (5-6)",
294 Durotar="Durotar Tiger (7-8)",
295 Mulgore="Elder Plainstrider (8-9), Flatland Cougar (7-8), Mazzranache (9)",
296 Teldrassil="Mangy Nightsaber (2), Nightsaber (5-6)",
297 TirisfalGlades="Greater Duskbat (6-7)"
298 }},
299  
300 [2] = {15, locations = {
301 Barrens="Ornery Plainstrider (16-17), Savannah Patriarch (15-16)",
302 Darkshore="Giant Foreststrider (17-19), Moonstalker Sire (17-18)",
303 HillsbradFoothills="Starving Mountain Lion (23-24)",
304 StonetalonMountains="Panther, Twilight Runner (23-24)"
305 }},
306  
307 [3] = {25, locations = {
308 ArathiHighlands="Highland Strider (30-31)",
309 HillsbradFoothills="Feral Mountain Lion (27-28)",
310 RazorfenKraul="Blind Hunter (32), Kraul Bat (30+-31+)",
311 StranglethornVale="Stranglethorn Tiger (32-33), Young Stranglethorn Panther (30-31), Young Stranglethorn Tiger (30-31)",
312 ThousandNeedles="Crag Stalker (25-26)"
313 }},
314  
315 [4] = {35, locations = {
316 Badlands="Ridge Huntress (38-39), Ridge Stalker (36-37)"
317 }},
318  
319 [5] = {45, locations = {
320 EasternPlaguelands="Noxious Plaguebat (54-56)",
321 StranglethornVale="Jaguero Stalker (50)"
322 }},
323  
324 [6] = {55, locations = {
325 EasternPlaguelands="Monstrous Plaguebat (57-58)",
326 Winterspring="Frostsaber Cub (55-56)"
327 }},
328 };
329  
330  
331 -- dash: rank = description, pet level, locations {zone_name=beast_list,
332 -- zone_name2=beast_list2,..}
333  
334 local HUNTERPETSKILLS_DATA_DASH = {
335 [1] = {"Increases movement speed by 40 for 15 seconds", 30,
336 locations = {
337 Badlands="Crag Coyote (36), Elder Crag Wolf (?)",
338 Desolace="Magram Bonepaw (37-38)",
339 StranglethornVale="Stranglethorn Tigers (32-33)",
340 SwampOfSorrows="Swamp Jaguar (37)"
341 }},
342  
343 [2] = {"Increases movement speed by 60 for 15 seconds", 40,
344 locations = {
345 Badlands="Broken Tooth (37), Ridge Stalker Patriarch (?)",
346 BlastedLands="Ashmane Boar (48)",
347 Feralas="Longtooth Runner (40-41)",
348 Hinterlands="Old Cliff Jumper (42), Silvermane Stalker (48)",
349 StranglethornVale="BhagTera (elite 43), Elder Shadowmaw Panther (41-43)",
350 Tanaris="Blisterpaw Hyena (41-42), Starving Blisterpaw (42)"
351 }},
352  
353 [3] = {"Increases movement speed by 80 for 15 seconds", 50,
354 locations = {
355 BlackrockSpires="Bloodaxe Worg (56-57)",
356 BlastedLands="Grunter (50), Hyena Ravage (elite (?))",
357 BlackrockSpires="Blackrock Worg (54-55)",
358 Hinterlands="Vilebranch Raiding Wolf (50-51)",
359 Winterspring="Frostsaber Huntress (58-59), Frostsaber Stalker (60), RakShiri (rare blue frostsaber (?))"
360 }},
361 };
362  
363  
364  
365 -- dive: rank = description, pet level, locations {zone_name=beast_list,
366 -- zone_name2=beast_list2,..}
367  
368 local HUNTERPETSKILLS_DATA_DIVE = {
369 [1] = {"Increases movement speed by 40 for 15 seconds", 30,
370 locations = {
371 ArathiHighlands="Mesa Buzzard (35), Young Mesa Buzzard (31)",
372 RazorfenKraul="Razorfen Kraul Bat (31)",
373 Desolace="Dread Flyer (36-37)"
374 }},
375  
376 [2] = {"Increases movement speed by 60 for 15 seconds", 40,
377 locations = {
378 Felwood="Ironbeak Owls (48-49)",
379 Feralas="Rogue Vale Screecher (46), Wind Serpent (44)",
380 Tanaris="Roc (42-43)"
381 }},
382  
383 [3] = {"Increases movement speed by 80 for 15 seconds", 50,
384 locations = {
385 Badlands="Zaricotl (55)",
386 BlastedLands="Spiteflayer (elite 52)",
387 EasternPlaguelands="Plaguebat (54)",
388 Felwood="Ironbeak Hunter (51), Ironbeak Screecher (53)",
389 Winterspring="Winterspring Owl (55), Winterspring Screecher (59)"
390 }},
391 };
392  
393  
394 -- growl: rank = pet level, learned from (and requirements), cost to buy
395  
396 local HUNTERPETSKILLS_DATA_GROWL = {
397 [1] = { 1, learn="Innate knowledge", cost="free" },
398 [2] = { 10, learn="Innate knowledge", cost="free" },
399 [3] = { 20, learn="Learned fom Pet Trainers, requires level 20", cost="30sp" },
400 [4] = { 30, learn="Learned fom Pet Trainers, requires level 30, Growl 3", cost="1gp" },
401 [5] = { 40, learn="Learned fom Pet Trainers, requires level 40, Growl 4", cost="2gp" },
402 [6] = { 50, learn="Learned fom Pet Trainers, requires level 50, Growl 5", cost="4gp 70sp" },
403 [7] = { 60, learn="Learned fom Pet Trainers, requires level 60, Growl 6", cost="5gp 90sp" }
404 };
405  
406 -- const strings
407 local HUNTERPETSKILLS_DESC_COWER = "Cower, causing no damage but lowering your threat, making the enemy less likey to attack you";
408 local HUNTERPETSKILLS_DESC_GROWL = "Taunt the target, increasing the likelihood the creature will focus atacks on you";
409  
410 -----------------------------------
411 -- local functions
412 -----------------------------------
413  
414 local function print_error(msg)
415 DEFAULT_CHAT_FRAME:AddMessage(msg.." Type /petskills or /sk help for a list of commands.");
416 end
417  
418 local function print_msg(msg)
419 DEFAULT_CHAT_FRAME:AddMessage(msg);
420 end
421  
422 local function print_debug(msg)
423 DEFAULT_CHAT_FRAME:AddMessage("Debug: "..msg);
424 end
425  
426 local function HelpColor()
427  
428 -- version: v0.2
429 -- last update: 2005
430  
431  
432 --== notes ==--
433 -- changed: regex is now "^(.-):(.*)$" (using non-greedy mode for first capture)
434  
435 -- output colorized help (keeps help strings clean of color codes)
436  
437 -- if first line, either color, or leave plain
438 -- all other lines, start with color blue, end before character ":"
439 -- color start: |cff, color end: |r
440  
441 local index;
442 local value;
443 for index, value in HUNTERPETSKILLS_HELP_TEXT do
444 local sText;
445  
446 if(index == 1) then
447  
448 -- header
449 sText = "|cff"..HUNTERPETSKILLS_COLOR["helpheader"]..value.."|r";
450 print_msg(sText);
451 else
452  
453 --color normally
454 local sStart, sEnd, sCmd, sDesc = string.find(value, "^(.-):(.*)$");
455 sText = "|cff"..HUNTERPETSKILLS_COLOR["help"]..sCmd.."|r:"..sDesc;
456 if( (sCmd == nil) or (sDesc == nil) ) then
457 -- if error in search, print non-colored string
458 print_msg(value);
459 end
460 -- print colored string
461 print_msg(sText);
462 end
463 end
464 end
465  
466 -----------------------------------
467 -- local command line functions
468 -----------------------------------
469  
470 local function HunterPetSkills_PrintSkillList(ZoneName, BeastList)
471 --output skill list so print code only needs to be changed in one place
472  
473 -- in color print: print_msg("<"..ZoneName.."> "..BeastList);
474 print_msg("|cff"..HUNTERPETSKILLS_COLOR["zone"].."<"..ZoneName..">|r "..BeastList);
475  
476 end
477  
478 local function HunterPetSkills_Skill(SkillName, SkillRank, SkillZone)
479  
480 -- Search for the skill, format:
481 -- description, pet level, locations {zone_name=beast_list, zone_name2=beast_list2,..}
482  
483 local index;
484 local value;
485 local bFilter = false;
486  
487 -- if not nil
488 if( (SkillRank == nil) or (SkillName == nil) ) then
489 print_error("Error: Skill Name and Rank required!");
490 return;
491 end
492  
493 -- make SkillName case-insensitive for compare
494 SkillName = string.lower(SkillName);
495 -- convert rank to number
496 SkillRank = tonumber(SkillRank);
497  
498 -- output skill name, rank, and zone
499 if( SkillZone and (SkillZone ~= "" )) then
500 -- lower and print
501 SkillZone = string.lower(SkillZone);
502 print_msg(string.format("Skill: %s (Rank %i) Zone: %s", SkillName, SkillRank, SkillZone));
503  
504 -- get ready for filter, remove spaces
505 bFilter = true;
506 SkillZone = string.gsub(SkillZone, "%s+", "");
507 else
508 -- no zone given, print none
509 print_msg(string.format("Skill: %s (Rank %i) Zone: All", SkillName, SkillRank));
510 end
511  
512 if( SkillName == "bite" ) then
513  
514 -- check if inbounds
515 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_BITE) ) then
516  
517 -- print desc, pet level
518 print_msg("Description: "..HUNTERPETSKILLS_DATA_BITE[SkillRank][1]);
519 print_msg("Requires pet level: "..HUNTERPETSKILLS_DATA_BITE[SkillRank][2]);
520  
521 -- print locations {zone_name=beast_list, zone_name2=beast_list2,..}
522 local ZoneName;
523 local BeastList;
524 for ZoneName, BeastList in HUNTERPETSKILLS_DATA_BITE[SkillRank]["locations"] do
525  
526 -- if filter, else regular
527 if(bFilter) then
528 if(string.lower(ZoneName) == SkillZone) then
529 -- filtering, so make sure it matches
530 -- (SkillZone was string.lower()'ed above)
531  
532 -- print filtered zone and beast list
533 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
534 end
535 else
536 -- no filter, print all zones
537 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
538 end
539  
540 end
541  
542 else
543 print_error("Error, invalid rank!");
544 end
545  
546 elseif( SkillName == "dash" ) then
547  
548 -- check if inbounds
549 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_DASH) ) then
550  
551 -- print desc, pet level
552 print_msg("Description: "..HUNTERPETSKILLS_DATA_DASH[SkillRank][1]);
553 print_msg("Requires Pet Level: "..HUNTERPETSKILLS_DATA_DASH[SkillRank][2]);
554  
555 -- print locations {zone_name=beast_list, zone_name2=beast_list2, ...}
556 local ZoneName;
557 local BeastList;
558  
559 -- for each zone, print beast list and color zone name
560 for ZoneName, BeastList in HUNTERPETSKILLS_DATA_DASH[SkillRank]["locations"] do
561  
562 -- if filter, else regular
563 if(bFilter) then
564 if(string.lower(ZoneName) == SkillZone) then
565 -- filtered, and made a match
566 -- SkillZone was string.lower()'ed above
567  
568 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
569 end
570 else
571 -- no filter, print all zones
572 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
573 end
574 end
575 else
576 -- first if failed
577 print_error("Error, invalid rank!");
578 end
579  
580 elseif( SkillName == "dive" ) then
581  
582 -- check if inbounds
583 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_DIVE) ) then
584  
585 -- print desc, pet level
586 print_msg("Description: "..HUNTERPETSKILLS_DATA_DIVE[SkillRank][1]);
587 print_msg("Requires Pet Level: "..HUNTERPETSKILLS_DATA_DIVE[SkillRank][2]);
588  
589 -- print locations {zone_name=beast_list, zone_name2=beast_list2, ...}
590 local ZoneName;
591 local BeastList;
592  
593 -- for each zone, print beast list and color zone name
594 for ZoneName, BeastList in HUNTERPETSKILLS_DATA_DIVE[SkillRank]["locations"] do
595  
596 -- if filter, else regular
597 if(bFilter) then
598 if(string.lower(ZoneName) == SkillZone) then
599 -- filtered, and made a match
600 -- SkillZone was string.lower()'ed above
601  
602 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
603 end
604 else
605 -- no filter, print all zones
606 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
607 end
608 end
609 else
610 -- first if failed
611 print_error("Error, invalid rank!");
612 end
613  
614 elseif( SkillName == "claw" ) then
615  
616 -- check if inbounds
617 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_CLAW) ) then
618  
619 -- print desc, pet level
620 print_msg("Description: "..HUNTERPETSKILLS_DATA_CLAW[SkillRank][1]);
621 print_msg("Requires pet level: "..HUNTERPETSKILLS_DATA_CLAW[SkillRank][2]);
622  
623 -- print locations {zone_name=beast_list, zone_name2=beast_list2,..}
624 local ZoneName;
625 local BeastList;
626 for ZoneName, BeastList in HUNTERPETSKILLS_DATA_CLAW[SkillRank]["locations"] do
627  
628 -- if filter, else regular
629 if(bFilter) then
630 if(string.lower(ZoneName) == SkillZone) then
631 -- filtering, so make sure it matches
632 -- (SkillZone was string.lower()'ed above)
633  
634 -- print filtered zone and beast list
635 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
636 end
637 else
638 -- no filter, print all zones
639 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
640 end
641  
642 end
643  
644 else
645 print_error("Error, invalid rank!");
646 end
647  
648 elseif( SkillName == "cower" ) then
649 -- cower: pet level, locations {zone_name=beast_list, zone_name2=beast_list2,..}
650  
651 -- check if inbounds
652 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_COWER) ) then
653  
654 -- print desc, pet level
655 print_msg("Description: "..HUNTERPETSKILLS_DESC_COWER);
656 print_msg("Requires pet level: "..HUNTERPETSKILLS_DATA_COWER[SkillRank][1]);
657  
658 -- print locations {zone_name=beast_list, zone_name2=beast_list2,..}
659 local ZoneName;
660 local BeastList;
661 for ZoneName, BeastList in HUNTERPETSKILLS_DATA_COWER[SkillRank]["locations"] do
662  
663 -- if filter, else regular
664 if(bFilter) then
665 if(string.lower(ZoneName) == SkillZone) then
666 -- filtering, so make sure it matches
667 -- (SkillZone was string.lower()'ed above)
668  
669 -- print filtered zone and beast list
670 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
671 end
672 else
673 -- no filter, print all zones
674 HunterPetSkills_PrintSkillList(ZoneName, BeastList);
675 end
676 end
677  
678 else
679 print_error("Error, invalid rank!");
680 end
681  
682 elseif( SkillName == "growl" ) then
683 -- growl: pet level, learned from (and requires), cost
684  
685 -- check if inbounds
686 if( tonumber(SkillRank) <= table.getn(HUNTERPETSKILLS_DATA_GROWL) ) then
687  
688 -- print desc, pet level
689 print_msg("Description: "..HUNTERPETSKILLS_DESC_GROWL);
690 print_msg("Requires pet level: "..HUNTERPETSKILLS_DATA_GROWL[SkillRank][1]);
691  
692 -- print learned from, requires rank X, cost
693 print_msg("Trained: "..HUNTERPETSKILLS_DATA_GROWL[SkillRank]["learn"]);
694 print_msg("Cost: "..HUNTERPETSKILLS_DATA_GROWL[SkillRank]["cost"]);
695  
696 else
697 print_error("Error, invalid rank!");
698 end
699  
700 else
701 -- invalid skill name
702 print_error("Error: Invalid skill name!");
703 end
704  
705 end
706  
707  
708 -----------------------------------
709 -- slash commands
710 -----------------------------------
711  
712 function HunterPetSkills_SlashCommandHandler(msg)
713  
714 if( msg ) then
715 local command = string.lower(msg);
716  
717 if( command == "" or command == HUNTERPETSKILLS_COMMANDS["help"] ) then
718  
719 -- print out help
720 HelpColor();
721  
722 --[[
723 -- old way that failed
724 elseif( string.find(command, "^growl ") ) then
725 -- find a skill name not prefixed by skill
726 local sStart, sEnd, sRank, sZone = string.find(command,
727 "^growl%s+(%d+)%s*([%a%d%s%p]*)%s*$");
728 HunterPetSkills_Skill("growl", sRank, sZone);
729 ]]
730  
731 -- growl
732 elseif( string.find(command, "^growl%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
733 -- found growl without "skill" in the command
734 local sStart, sEnd, sRank, sZone = string.find(command,
735 "^growl%s+(%d+)%s*([%a%d%s%p]*)%s*$");
736 HunterPetSkills_Skill("growl", sRank, sZone);
737  
738 -- claw
739 elseif( string.find(command, "^claw%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
740 -- found claw without "skill" in the command
741 local sStart, sEnd, sRank, sZone = string.find(command,
742 "^claw%s+(%d+)%s*([%a%d%s%p]*)%s*$");
743 HunterPetSkills_Skill("claw", sRank, sZone);
744  
745 -- bite
746 elseif( string.find(command, "^bite%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
747 -- found bite without "skill" in the command
748 local sStart, sEnd, sRank, sZone = string.find(command,
749 "^bite%s+(%d+)%s*([%a%d%s%p]*)%s*$");
750 HunterPetSkills_Skill("bite", sRank, sZone);
751  
752 -- dash
753 elseif( string.find(command, "^dash%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
754 -- found dash without "skill" in the command
755 local sStart, sEnd, sRank, sZone = string.find(command,
756 "^dash%s+(%d+)%s*([%a%d%s%p]*)%s*$");
757 HunterPetSkills_Skill("dash", sRank, sZone);
758  
759 -- dive
760 elseif( string.find(command, "^dive%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
761 -- found dive without "skill" in the command
762 local sStart, sEnd, sRank, sZone = string.find(command,
763 "^dive%s+(%d+)%s*([%a%d%s%p]*)%s*$");
764 HunterPetSkills_Skill("dive", sRank, sZone);
765  
766  
767 -- cower
768 elseif( string.find(command, "^cower%s+(%d+)%s*([%a%d%s%p]*)%s*$") ) then
769 -- found cower without "skill" in the command
770 local sStart, sEnd, sRank, sZone = string.find(command,
771 "^cower%s+(%d+)%s*([%a%d%s%p]*)%s*$");
772 HunterPetSkills_Skill("cower", sRank, sZone);
773  
774 -- else they used "/sk skill <SkillName> <Rank> [<Zone>]
775 elseif( string.find(command, "^"..HUNTERPETSKILLS_COMMANDS["skill"].." ") ) then
776  
777 -- search for a skill
778 -- does %d equal [0-9], and does [%a%d] equal [%w] ?
779 -- %a = all letters
780 -- %d = all digits
781 -- %p = all punctuation
782 -- %s = all space
783 -- %w = alphanumeric
784  
785 local sStart, sEnd, sSkill, sRank, sZone = string.find(command,
786 "^"..HUNTERPETSKILLS_COMMANDS["skill"].."%s+(%a+)%s+(%d+)%s*([%a%d%s%p]*)%s*$");
787  
788 -- print_debug(string.format("Skill: %s (Rank %s), [%s]", sSkill, sRank, sZone));
789 HunterPetSkills_Skill(sSkill, sRank, sZone);
790  
791 else
792 -- invalid flag/command
793 print_error("CommandHandler: "..msg..": command not found!");
794 end
795 else
796 -- no msg
797 print_error("HunterPetSkills: CommandHandler: No command given!");
798 end
799 end
800  
801  
802  
803 ------------------------------------
804 -- OnFoo functions
805 ------------------------------------
806  
807 function HunterPetSkills_OnEvent()
808 if( event == "VARIABLES_LOADED" ) then
809  
810 -- check if variables exist, if not create/set them
811 end
812 end
813  
814 function HunterPetSkills_OnLoad()
815  
816 -- Register events
817 this:RegisterEvent("VARIABLES_LOADED");
818  
819 -- Register slash command
820 SLASH_HUNTERPETSKILLS1 = "/hunterpetskills";
821 SLASH_HUNTERPETSKILLS2 = "/petskills";
822 SLASH_HUNTERPETSKILLS3 = "/sk";
823  
824 SlashCmdList["HUNTERPETSKILLS"] = function(msg)
825 HunterPetSkills_SlashCommandHandler(msg);
826 end
827  
828 -- loaded okay so show loaded text
829 -- show on defualt chat window
830 if( DEFAULT_CHAT_FRAME ) then
831 DEFAULT_CHAT_FRAME:AddMessage("ninmonkey's "..HUNTERPETSKILLS_MOD_NAME.." loaded!");
832 end
833  
834 -- show pop-up text like an error
835 UIErrorsFrame:AddMessage("ninmonkey's "..HUNTERPETSKILLS_MOD_NAME.." loaded!", 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME);
836  
837 end