TrinityCore/TrinityCore — Issue #4453: [NPC/FIX] Apothecary Keever
Author: Discover-
Created: 2011-12-23 12:01:22+00:00
State: open
Labels: Database-Miscellaneous, Database-SmartAI, Patch-Fix

Had this one laying around for a loooong time..

```sql
-- Apothecary Keever SAI
SET @ENTRY := 5734;
SET @ENTRY_CAGED_FEMALE := 5735;
SET @ENTRY_CAGED_DWARF := 5738;
SET @ENTRY_CAGED_MALE := 5736;
SET @ENTRY_CAGED_TOAD := 5742;
SET @ENTRY_CAGED_SQUIRREL := 5739;
SET @ENTRY_CAGED_RABBIT := 5741;
SET @ENTRY_CAGED_SHEEP := 5743;
SET @SPELL_EXPLODE := 7670; -- Taken from sniff!
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@ENTRY,@ENTRY_CAGED_FEMALE,@ENTRY_CAGED_DWARF,@ENTRY_CAGED_MALE,@ENTRY_CAGED_TOAD,@ENTRY_CAGED_SQUIRREL,@ENTRY_CAGED_RABBIT,@ENTRY_CAGED_SHEEP);
DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (@ENTRY,0,0,257,0,NULL);
DELETE FROM `creature` WHERE `id`=@ENTRY_CAGED_SQUIRREL; -- Remove Caged Squirrel
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100,@ENTRY_CAGED_FEMALE,@ENTRY_CAGED_DWARF,@ENTRY_CAGED_MALE,@ENTRY_CAGED_TOAD,@ENTRY_CAGED_SQUIRREL,@ENTRY_CAGED_RABBIT,@ENTRY_CAGED_SHEEP);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,1,0,100,0,0,30000,290000,450000,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - Out of Combat - Run Script"),
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 0"),
(@ENTRY*100,9,1,0,0,0,100,0,9000,9000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 1"),
(@ENTRY*100,9,2,0,0,0,100,0,500,500,0,0,45,1,1,0,0,0,0,19,@ENTRY_CAGED_MALE,0,0,0,0,0,0,"Apothecary Keever - On Script - Set Data Caged Human Male"), -- Turns into a toad
(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 2"),
(@ENTRY*100,9,4,0,0,0,100,0,5000,5000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 3"),
(@ENTRY*100,9,5,0,0,0,100,0,9000,9000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 4"),
(@ENTRY*100,9,6,0,0,0,100,0,500,500,0,0,45,2,2,0,0,0,0,19,@ENTRY_CAGED_TOAD,0,0,0,0,0,0,"Apothecary Keever - On Script - Set Data Caged Toad"), -- Turns into a squirrel
(@ENTRY*100,9,7,0,0,0,100,0,5000,5000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 5"),
(@ENTRY*100,9,8,0,0,0,100,0,9000,9000,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 6"),
(@ENTRY*100,9,9,0,0,0,100,0,9000,9000,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 7"),
(@ENTRY*100,9,10,0,0,0,100,0,500,500,0,0,45,3,3,0,0,0,0,19,@ENTRY_CAGED_SQUIRREL,0,0,0,0,0,0,"Apothecary Keever - On Script - Set Data Caged Squirrel"), -- Turns into a rabbit
(@ENTRY*100,9,11,0,0,0,100,0,5000,5000,0,0,1,8,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 8"),
(@ENTRY*100,9,12,0,0,0,100,0,9000,9000,0,0,1,9,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 9"),
(@ENTRY*100,9,13,0,0,0,100,0,9000,9000,0,0,1,10,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 10"),
(@ENTRY*100,9,14,0,0,0,100,0,500,500,0,0,45,4,4,0,0,0,0,19,@ENTRY_CAGED_RABBIT,0,0,0,0,0,0,"Apothecary Keever - On Script - Set Data Caged Rabbit"), -- Turns into a sheep
(@ENTRY*100,9,15,0,0,0,100,0,5000,5000,0,0,1,11,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 11"),
(@ENTRY*100,9,16,0,0,0,100,0,5000,5000,0,0,1,12,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 12"),
(@ENTRY*100,9,17,0,0,0,100,0,500,500,0,0,45,5,5,0,0,0,0,19,@ENTRY_CAGED_SHEEP,0,0,0,0,0,0,"Apothecary Keever - On Script - Set Data Caged Sheep"), -- Sheep explodes
(@ENTRY*100,9,18,0,0,0,100,0,9000,9000,0,0,1,13,0,0,0,0,0,1,0,0,0,0,0,0,0,"Apothecary Keever - On Script - Say Line 13"),

(@ENTRY_CAGED_FEMALE,0,0,0,1,0,100,0,0,13000,29000,45000,10,18,20,1,0,0,0,1,0,0,0,0,0,0,0,"Caged Human Female - Out of Combat - Play Random Emote"),
(@ENTRY_CAGED_DWARF,0,0,0,1,0,100,0,0,13000,29000,45000,10,18,20,1,0,0,0,1,0,0,0,0,0,0,0,"Caged Dwarf Male - Out of Combat - Play Random Emote"),
(@ENTRY_CAGED_MALE,0,0,0,38,0,100,0,0,1,1,0,36,@ENTRY_CAGED_TOAD,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Human Male - On Data Set - Update Entry"),
(@ENTRY_CAGED_TOAD,0,0,0,38,0,100,0,0,2,2,0,36,@ENTRY_CAGED_SQUIRREL,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Toad - On Data Set - Update Entry"),
(@ENTRY_CAGED_SQUIRREL,0,0,0,38,0,100,0,0,3,3,0,36,@ENTRY_CAGED_RABBIT,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Squirrel - On Data Set - Update Entry"),
(@ENTRY_CAGED_RABBIT,0,0,0,38,0,100,0,0,4,4,0,36,@ENTRY_CAGED_SHEEP,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Rabbit - On Data Set - Update Entry"),
(@ENTRY_CAGED_SHEEP,0,1,0,38,0,100,0,0,5,5,0,11,@SPELL_EXPLODE,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Sheep - On Data Set - Cast Explode"),
(@ENTRY_CAGED_SHEEP,1,0,0,61,0,100,0,0,0,0,0,41,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Caged Sheep - On Data Set - Forced Despawn");

-- Texts
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0,"Hmm, it would seem Keever needs a new subject. If that fool, Abernathy, keeps taking Keever's subjects, Keever may have to have a word with him.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,1,0,"Ahh, there we go, now Keever must try this vial and see if it works.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,2,0,"%s forces the fluid down the weary man's throat. Apothecary Keever pokes the small toad.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,3,0,"Not what Keever was hoping for. Keever may have added too much earthroot. Let's see if the second serum will do what I need.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,4,0,"%s feeds the toad some of the strange liquid.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,5,0,"%s pokes the fuzzy squirrel with obvious disappointment.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,6,0,"Well, this is just not right. The creature is far too small. Let us see what Keever's third batch will do.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,7,0,"%s feeds the squirrel some of the viscous fluid.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,8,0,"%s pokes the skittish rabbit.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,9,0,"Keever is unhappy with this. Prehaps if Keever were to try a larger dose, that may fix this dilemma.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,10,0,"Apothecary Keever grabs the rabbit and pours the liquid down its throat.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,11,0,"What is this? Did Keever ask for a sheep? Keever wanted a weapon of great power and all he got was this sheep. Keever is very disappointed.",12,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,12,0,"%s pokes the wooly sheep repeatedly.",16,0,100,0,0,0,"Apothecary Keever"),
(@ENTRY,13,0,"Keever is most pleased.",12,0,100,0,0,0,"Apothecary Keever");
```