Sign in to follow this  
Followers 0
Florix

[MoP] Pit of Saron Ice cave

1 post in this topic

Perhaps a fix for the missing http://www.wowhead.com/npc=36847/collapsing-icicle in Pit of Saron.


https://www.youtube.com/watch?v=yQ3agrSMtwg


SQL Spawns:

REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `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`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES 
('36847', '0', '0', '0', '0', '0', '28470', '28470', '0', '0', 'Collapsing Icicle', '', '', '0', '80', '80', '2', '16', '16', '0', '1', '1.14286', '1', '0', '420', '630', '0', '157', '1', '2000', '0', '1', '33587200', '2048', '8', '0', '0', '0', '0', '0', '336', '504', '126', '4', '8', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '0', '3', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '128', 'npc_tyrannus_icicle', '12340');

DELETE FROM `creature` WHERE `id`= 36847 AND `map`= 658;
INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
('36847', '658', '3', '1', '0', '0', '1036.61', '-125.366', '626.969', '6.25296', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1062.25', '86.7559', '631.4', '3.34487', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1065.06', '-42.9411', '634.078', '1.3362', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '990.842', '-124.486', '609.455', '1.80675', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '966.14', '-115.19', '596.969', '2.58241', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1076.19', '-25.3407', '633.061', '0.67097', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1000.28', '-125.792', '615.723', '6.13036', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '958.256', '-120.405', '596.76', '1.57317', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1008.74', '-127.569', '620.514', '2.58428', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1010.3', '-140.404', '621.004', '5.2507', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1066.93', '81.1746', '631.148', '2.92075', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '996.271', '-138.675', '615.209', '5.23107', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1067.58', '42.8692', '630.02', '3.54515', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1048.42', '-115.159', '629.321', '0.185797', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1060.46', '60.0116', '631.876', '3.59619', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1041.49', '-126.151', '627.296', '0.547081', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1071.58', '27.1523', '631.023', '3.75642', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1027.21', '-134.105', '624.883', '0.0458658', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '981.824', '-134.53', '607.863', '4.49203', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1070.19', '-84.4603', '632.964', '0.374871', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1072.97', '7.89368', '635.093', '3.69804', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1073.12', '88.8492', '631.517', '0.756978', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1056.43', '-109.096', '630.812', '0.24863', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1066.5', '-70.3791', '633.454', '0.62306', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1018', '-130.183', '623.412', '0.18331', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1070.06', '-21.7566', '633.312', '1.23552', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '970.86', '-128.719', '601.363', '4.96531', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1080.31', '-7.66938', '633.001', '0.815336', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1041.17', '-98.9387', '630.634', '3.09177', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '947.9', '-97.7703', '595.3', '2.4746', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1019.58', '-133.619', '623.619', '0.00266933', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1030.5', '-115.79', '626.729', '2.9322', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1039.44', '-116.002', '628.716', '0.986903', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1068.37', '-60.1127', '633.65', '0.968636', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1021.54', '-122.533', '624.417', '3.25814', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '980.224', '-118.727', '601.291', '4.93861', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1073.45', '56.0787', '631.457', '5.04918', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '946.369', '-105.559', '594.913', '1.98551', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1068.4', '-3.64011', '634.493', '1.84843', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1084.4', '24.8804', '631.15', '5.85815', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1059.37', '-39.4403', '633.853', '3.75916', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1062.68', '-23.5949', '633.979', '3.88703', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1047.24', '-80.3937', '632.765', '2.03913', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1070.94', '64.0951', '631.805', '5.17092', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '951.48', '-102.684', '594.884', '1.55354', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1060.29', '-77.9755', '633.68', '1.10922', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1074.34', '19.3475', '633.057', '1.1646', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1080.93', '8.36794', '633.991', '0.968784', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '948.803', '-111.4', '595.055', '1.66742', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '957.585', '-110.981', '595.546', '1.63208', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1076.58', '42.4665', '629.888', '0.623467', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1073.96', '72.9475', '630.935', '0.195418', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '985.007', '-128.154', '607.844', '0.0549958', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1072.33', '-41.3969', '633.544', '0.843758', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '951.231', '-96.2187', '595.171', '1.64601', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1038.07', '-106.632', '628.836', '0.26041', '300', '0', '0', '12600', '0', '0', '0', '0', '0'),
('36847', '658', '3', '1', '0', '0', '1058.81', '-60.7312', '633.696', '1.81529', '300', '0', '0', '12600', '0', '0', '0', '0', '0');

cpp:

 

enum Spells
{
    // Collapsing Icicle
    SPELL_ICICLE_SUMMON         = 69424,
    SPELL_ICICLE_FALL_TRIGGER   = 69426,
    SPELL_ICICLE_FALL_VISUAL    = 69428
};

class DelayedIcicleFallEvent : public BasicEvent
{
    public:
        DelayedIcicleFallEvent(Creature* trigger, uint64 casterGUID) : _trigger(trigger), _casterGUID(casterGUID) { }

        bool Execute(uint64 /*time*/, uint32 /*diff*/) override
        {
            _trigger->CastSpell(_trigger, SPELL_ICICLE_FALL_TRIGGER, true);
            _trigger->CastSpell(_trigger, SPELL_ICICLE_FALL_VISUAL, false);

            if (Unit* caster = ObjectAccessor::GetUnit(*_trigger, _casterGUID))
                caster->RemoveDynObject(SPELL_ICICLE_SUMMON);

            /// @todo: fix snowfall visual after collapse

            return true;
        }

    private:
        Creature* _trigger;
        uint64 _casterGUID;
};

/// @todo: delete duplicate spawns in db
class npc_pit_of_saron_icicle : public CreatureScript
{
    public:
        npc_pit_of_saron_icicle() : CreatureScript("npc_pit_of_saron_icicle") { }

        struct npc_pit_of_saron_icicleAI : public ScriptedAI
        {
            npc_pit_of_saron_icicleAI(Creature* creature) : ScriptedAI(creature) { }

            uint32 timer;

            void Reset() override
            {
                timer = urand(1000, 30000);
            }

            void JustSummoned(Creature* summon) override
            {
                summon->SetReactState(REACT_PASSIVE);
                summon->m_Events.AddEvent(new DelayedIcicleFallEvent(summon, me->GetGUID()), summon->m_Events.CalculateTime(3000));
            }

            void UpdateAI(uint32 diff) override
            {
                UpdateVictim();

                if (timer <= diff)
                {
                    if (urand(1, 8) == 1)
                    {
                        me->CastSpell(me, SPELL_ICICLE_SUMMON, true);
                        timer = urand(20000, 35000);
                    }
                    else
                        timer = urand(1000, 20000);
                }
                else
                    timer -= diff;
            }
        };

        CreatureAI* GetAI(Creature* creature) const override
        {
            return GetPitOfSaronAI<npc_pit_of_saron_icicleAI>(creature);
        }
};

class spell_pos_ice_shards : public SpellScriptLoader
{
    public:
        spell_pos_ice_shards() : SpellScriptLoader("spell_pos_ice_shards") { }

        class spell_pos_ice_shards_SpellScript : public SpellScript
        {
            PrepareSpellScript(spell_pos_ice_shards_SpellScript);

            bool Load() override
            {
                // This script should execute only in Pit of Saron
                if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
                    if (instance->GetInstanceScript())
                        if (instance->GetScriptId() == sObjectMgr->GetScriptId(PoSScriptName))
                            return true;

                return false;
            }

            void HandleScriptEffect(SpellEffIndex /*effIndex*/)
            {
                if (GetHitPlayer())
                    GetCaster()->GetInstanceScript()->SetData(DATA_ICE_SHARDS_HIT, 1);
            }

            void Register() override
            {
                OnEffectHitTarget += SpellEffectFn(spell_pos_ice_shards_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
            }
        };

        SpellScript* GetSpellScript() const override
        {
            return new spell_pos_ice_shards_SpellScript();
        }
};
UPDATE creature_template SET ScriptName='npc_tyrannus_icicle' WHERE entry=32780;

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0