Show
Ignore:
Timestamp:
11/22/08 01:55:20 (17 years ago)
Author:
yumileroy
Message:

Merge with 284 (54b0e67d97fe).

Original author: megamage
Date: 2008-11-21 19:49:54-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/scripts/npc/npcs_special.cpp

    r283 r284  
    826826} 
    827827 
     828struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI 
     829{ 
     830    npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {Reset();} 
     831 
     832    void Reset() {} 
     833    void Aggro(Unit *who) {} 
     834     
     835    void OnPossess(bool apply) 
     836    { 
     837        if (apply) 
     838        { 
     839            // Initialize the action bar without the melee attack command 
     840            m_creature->InitCharmInfo(m_creature); 
     841            m_creature->GetCharmInfo()->InitEmptyActionBar(false); 
     842 
     843            m_creature->SetAggressive(false); 
     844        } 
     845        else 
     846            m_creature->SetAggressive(true); 
     847    } 
     848 
     849}; 
     850 
     851CreatureAI* GetAI_npc_steam_tonk(Creature *_Creature) 
     852{ 
     853    return new npc_steam_tonkAI(_Creature); 
     854} 
     855 
     856#define SPELL_TONK_MINE_DETONATE 25099    
     857 
     858struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI 
     859{ 
     860    npc_tonk_mineAI(Creature *c) : ScriptedAI(c)  
     861    { 
     862        m_creature->SetAggressive(false); 
     863        Reset(); 
     864    } 
     865 
     866    uint32 ExplosionTimer; 
     867 
     868    void Reset() 
     869    { 
     870        ExplosionTimer = 3000; 
     871    } 
     872 
     873    void Aggro(Unit *who) {} 
     874    void AttackStart(Unit *who) {} 
     875    void MoveInLineOfSight(Unit *who) {} 
     876 
     877    void UpdateAI(const uint32 diff) 
     878    { 
     879        if (ExplosionTimer < diff) 
     880        { 
     881            m_creature->CastSpell(m_creature, SPELL_TONK_MINE_DETONATE, true); 
     882            m_creature->setDeathState(DEAD); // unsummon it 
     883        } else 
     884            ExplosionTimer -= diff; 
     885    } 
     886}; 
     887 
     888CreatureAI* GetAI_npc_tonk_mine(Creature *_Creature) 
     889{ 
     890    return new npc_tonk_mineAI(_Creature); 
     891} 
     892 
    828893void AddSC_npcs_special() 
    829894{ 
     
    876941    newscript->pGossipSelect = &GossipSelect_npc_sayge; 
    877942    newscript->RegisterSelf(); 
    878 } 
     943 
     944    newscript = new Script; 
     945    newscript->Name="npc_steam_tonk"; 
     946    newscript->GetAI = &GetAI_npc_steam_tonk; 
     947    newscript->RegisterSelf(); 
     948 
     949    newscript = new Script; 
     950    newscript->Name="npc_tonk_mine"; 
     951    newscript->GetAI = &GetAI_npc_tonk_mine; 
     952    newscript->RegisterSelf(); 
     953}