-- Add custom creature Ossirian Aggro Trigger
REPLACE INTO `creature_template` (`entry`, `patch`, `KillCredit1`, `KillCredit2`, `modelid_1`, `modelid_2`, `modelid_3`, `modelid_4`, `name`, `subname`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spells_template`, `PetSpellDataId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Civilian`, `RacialLeader`, `RegenHealth`, `equipment_id`, `trainer_id`, `vendor_id`, `MechanicImmuneMask`, `SchoolImmuneMask`, `flags_extra`, `ScriptName`) VALUES (99901, 7, 0, 0, 1126, 0, 0, 0, 'Ossirian Agro Trigger', '', 0, 1, 1, 64, 64, 0, 0, 20, 35, 35, 0, 0.91, 1.14286, 1, 0, 2, 2, 0, 44, 1, 2000, 2200, 1, 0, 0, 0, 0, 0, 0, 0, 1.76, 2.42, 100, 10, 0, 0, 0, 100008, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EventAI', 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 128, '');
REPLACE INTO `creature` (`guid`, `id`, `map`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`, `spawnFlags`, `visibilitymod`, `patch_min`, `patch_max`) VALUES (509001, 99901, 509, 0, 0, -9481.09, 1993.65, 92.7428, 2.38794, 1, 1, 0, 0, 64, 0, 0, 0, 0, 0, 7, 10);
REPLACE INTO `creature` (`guid`, `id`, `map`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`, `spawnFlags`, `visibilitymod`, `patch_min`, `patch_max`) VALUES (509002, 99901, 509, 0, 0, -9470.54, 2007.47, 91.8306, 2.36046, 1, 1, 0, 0, 64, 0, 0, 0, 0, 0, 7, 10);
REPLACE INTO `creature` (`guid`, `id`, `map`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`, `spawnFlags`, `visibilitymod`, `patch_min`, `patch_max`) VALUES (509003, 99901, 509, 0, 0, -9459.25, 2021.93, 92.8492, 2.37224, 1, 1, 0, 0, 64, 0, 0, 0, 0, 0, 7, 10);

-- Conditions
REPLACE INTO `conditions` VALUES (99900, 43, 0, 0, 3); -- Ossirian not in combat.
REPLACE INTO `conditions` VALUES (99901, 44, 0, 0, 2); -- Ossirian hostile to player.
REPLACE INTO `conditions` VALUES (99902, -1, 99900, 99901, 0); -- Ossirian not in combat and hostile to player.

-- Events list and script
DELETE FROM `creature_ai_events` WHERE `creature_id`=99901;
INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (9990101, 99901, 0, 10, 0, 100, 1, 1, 9, 1000, 1000, 9990101, 0, 0, 'Ossirian Aggro Trigger - Make Ossirian Aggro Unit on Enter LoS');
DELETE FROM `creature_ai_scripts` WHERE `id`=9990101;
INSERT INTO `creature_ai_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES (9990101, 0, 26, 0, 0, 0, 0, 90893, 0, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 99902, 'Ossirian Aggro Trigger - Make Ossirian Aggro Unit');
