[Completed][WIP] Emerald Lasher SAI

-- Emerald Lasher
SET @ENTRY := 27254;
SET @SPELL1 := 51901; -- Dream Lash
SET @SPELL2 := 48195; -- Emerald Lasher Emerge
-- Remove old script
DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY;
-- Add new script (this will fix their submerge/emerge visual)
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@ENTRY;
UPDATE `creature` SET `modelid`=0,`curhealth`=1,`curmana`=0 WHERE `id`=@ENTRY;
DELETE FROM `creature_addon` WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id`=@ENTRY);
DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
INSERT INTO `creature_template_addon` (`entry`,`bytes1`) VALUES
(@ENTRY,9); -- Set sitting flag
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
(@ENTRY,0,0,0,4,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On aggro - Set Phase 1'),
(@ENTRY,0,1,0,4,1,100,1,0,0,0,0,11,@SPELL2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On aggro - Cast Emerald Lasher Emerge'),
(@ENTRY,0,2,0,4,1,100,1,0,0,0,0,91,9,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On aggro - Remove Sitting flag'),
(@ENTRY,0,3,0,0,1,100,0,2000,4000,7000,10000,11,@SPELL1,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Emerald Lasher - Combat - Cast Dream Lash'),
(@ENTRY,0,4,0,7,1,100,1,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On evade - Set Phase 2'),
(@ENTRY,0,5,0,7,2,100,1,0,0,0,0,91,9,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On evade - Remove Sitting flag'),
(@ENTRY,0,6,0,21,2,100,1,0,0,0,0,90,9,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Emerald Lasher - On reached home - Set Sitting flag');
[/SQL]

Not really working as it should... Yet

I believe this was closed by a Pitcrawler’s post in issuetracker, haven’t test it, but it was pushed. /can be closed or removed to completed/

https://github.com/TrinityCore/TrinityCore/issues/8256