TrinityCore/TrinityCore — Issue #5268: [DB\FIX][QUEST] Deep in the Bowels of the Underhalls
Author: Valcorb
Created: 2012-02-16 18:26:03+00:00
State: open

```sql

-- [Q] Deep in the Bowels of The Underhalls (13042)

SET @ENTRY := 30409; -- Apprentice Osterkilgr
SET @SPELL_BLAST := 60290; -- Blast Wave
SET @SPELL_FIREBALL := 14034; -- Fireball
SET @QUEST := 13042; -- Deep in the Bowels of the Underhalls

UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
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
-- Combat Script
(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 5000, 7000, 5000, 7000, 11, @SPELL_BLAST, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Apprentice Osterkilgr - In Combat - cast Blast Wave'),
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 1000, 2000, 1000, 2000, 11, @SPELL_FIREBALL, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Apprentice Osterkilgr - In Combat - cast Fireball'),

-- Quest 13042
(@ENTRY, 0, 2, 0, 2, 0, 100, 1, 40, 80, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apprentice Osterkilgr - @80%HP - say text 0'),
(@ENTRY, 0, 3, 4, 2, 0, 100, 1, 0, 40, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apprentice Osterkilgr - @40%HP - say text 1'),
(@ENTRY, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 33, 30412, 0, 0, 0, 0, 0,7, 0, 0, 0, 0, 0, 0 ,0, 'Apprentice Osterkilgr - At 40% HP - give kill credit');

-- Texts
DELETE FROM `creature_ai_texts` WHERE `entry` IN (-10020,-10021);
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,'You''ve come for the doctor''s plans! You''ll only find death!', 12, 0, 0, 0, 0, 0,'Apprentice Osterkilgr - Say 0'),
(@ENTRY, 1, 0,'The doctor entrusted me with the plans to Nergeld, our flesh giant amalgamation made entirely of vargul! It will be the most powerful creation of its kind and a whole legion of them will be created to destroy your pitiful forces!', 12, 0, 0, 0, 0, 0,'Apprentice Osterkilgr - Say 1');

-- SAI Conditions
DELETE FROM `conditions` WHERE `SourceEntry`=@ENTRY AND `SourceTypeOrReferenceId`=22;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`)
VALUES
(22, 3, @ENTRY, 0, 0, 9, 0, @QUEST, 0, 0, 0, 0, '', 'Only execute SAI of Osterkilgr when player has quest 13042'),
(22, 4, @ENTRY, 0, 0, 9, 0, @QUEST, 0, 0, 0, 0, '', 'Only execute SAI of Osterkilgr when player has quest 13042'),
(22, 5, @ENTRY, 0, 0, 9, 0, @QUEST, 0, 0, 0, 0, '', 'Only execute SAI of Osterkilgr when player has quest 13042');