Changeset 278

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

Added tonk mine and steam tonk scripts.

Original author: gvcoman
Date: 2008-11-21 13:57:54-05:00

Files:
1 modified

Legend:

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

    r272 r278  
    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    } 
     844 
     845}; 
     846 
     847CreatureAI* GetAI_npc_steam_tonk(Creature *_Creature) 
     848{ 
     849    return new npc_steam_tonkAI(_Creature); 
     850} 
     851 
     852#define SPELL_TONK_MINE_DETONATE 25099    
     853 
     854struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI 
     855{ 
     856    npc_tonk_mineAI(Creature *c) : ScriptedAI(c) {Reset();} 
     857 
     858    uint32 ExplosionTimer; 
     859 
     860    void Reset() 
     861    { 
     862        ExplosionTimer = 3000; 
     863    } 
     864 
     865    void Aggro(Unit *who) {} 
     866    void AttackStart(Unit *who) {} 
     867    void MoveInLineOfSight(Unit *who) {} 
     868 
     869    void UpdateAI(const uint32 diff) 
     870    { 
     871        if (ExplosionTimer < diff) 
     872        { 
     873            m_creature->CastSpell(m_creature, SPELL_TONK_MINE_DETONATE, true); 
     874            m_creature->setDeathState(DEAD); // unsummon it 
     875        } else 
     876            ExplosionTimer -= diff; 
     877    } 
     878}; 
     879 
     880CreatureAI* GetAI_npc_tonk_mine(Creature *_Creature) 
     881{ 
     882    return new npc_tonk_mineAI(_Creature); 
     883} 
     884 
    828885void AddSC_npcs_special() 
    829886{ 
     
    876933    newscript->pGossipSelect = &GossipSelect_npc_sayge; 
    877934    m_scripts[nrscripts++] = newscript; 
    878 } 
     935 
     936    newscript = new Script; 
     937    newscript->Name="npc_steam_tonk"; 
     938    newscript->GetAI = &GetAI_npc_steam_tonk; 
     939    m_scripts[nrscripts++] = newscript; 
     940 
     941    newscript = new Script; 
     942    newscript->Name="npc_tonk_mine"; 
     943    newscript->GetAI = &GetAI_npc_tonk_mine; 
     944    m_scripts[nrscripts++] = newscript; 
     945}