Changeset 284

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

Location:
trunk/src
Files:
13 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} 
  • trunk/src/game/Creature.cpp

    r283 r284  
    148148    i_AI = NULL; 
    149149 
    150     DeletePossessedAI(); 
     150    if (i_AI_possessed) 
     151    { 
     152        delete i_AI_possessed; 
     153        i_AI_possessed = NULL; 
     154    } 
    151155} 
    152156 
     
    563567} 
    564568 
    565 void Creature::DeletePossessedAI() 
     569void Creature::DisablePossessedAI() 
    566570{ 
    567571    if (!i_AI_possessed) return; 
    568  
    569     delete i_AI_possessed; 
    570     i_AI_possessed = NULL; 
    571572 
    572573    // Signal the old AI that it's been re-enabled 
  • trunk/src/game/Creature.h

    r283 r284  
    461461        bool AIM_Initialize(); 
    462462        void InitPossessedAI(); 
    463         void DeletePossessedAI(); 
     463        void DisablePossessedAI(); 
    464464 
    465465        void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); 
  • trunk/src/game/PetHandler.cpp

    r283 r284  
    9898                case COMMAND_ATTACK:                        //spellid=1792  //ATTACK 
    9999                { 
     100                    // Can't attack if owner is pacified 
     101                    if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
     102                    { 
     103                        //pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED); 
     104                        //TODO: Send proper error message to client 
     105                        return; 
     106                    } 
    100107                    // only place where pet can be player 
    101108                    pet->clearUnitState(UNIT_STAT_FOLLOW); 
  • trunk/src/game/Player.cpp

    r283 r284  
    1895718957                target->AddThreat(this, 1000000.0f); 
    1895818958        } 
    18959         // Delete the assigned possessed AI 
    18960         ((Creature*)target)->DeletePossessedAI(); 
     18959        // Disable the assigned possessed AI 
     18960        ((Creature*)target)->DisablePossessedAI(); 
    1896118961    } 
    1896218962} 
  • trunk/src/game/PossessedAI.cpp

    r283 r284  
    2525void PossessedAI::AttackStart(Unit *u) 
    2626{ 
    27     if( !u ) 
     27    if( !u || i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
    2828        return; 
    2929 
     
    9696            return; 
    9797        } 
    98         else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady()) 
     98        else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady() && !i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
    9999        { 
    100100            i_pet.AttackerStateUpdate(i_pet.getVictim()); 
  • trunk/src/game/SharedDefines.h

    r283 r284  
    20702070    SUMMON_TYPE_CRITTER3    = 307, 
    20712071    SUMMON_TYPE_UNKNOWN5    = 409, 
    2072     SUMMON_TYPE_UNKNOWN2    = 427, 
     2072    SUMMON_TYPE_POSESSED3   = 427, 
    20732073    SUMMON_TYPE_POSESSED2   = 428 
    20742074}; 
  • trunk/src/game/Spell.cpp

    r283 r284  
    15341534        case TARGET_SCRIPT: 
    15351535        case TARGET_SCRIPT_COORDINATES: 
     1536        case TARGET_UNIT_AREA_SCRIPT: 
    15361537        { 
    15371538            SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); 
     
    38663867                    case SUMMON_TYPE_POSESSED: 
    38673868                    case SUMMON_TYPE_POSESSED2: 
     3869                    case SUMMON_TYPE_POSESSED3: 
    38683870                    case SUMMON_TYPE_DEMON: 
    38693871                    case SUMMON_TYPE_SUMMON: 
  • trunk/src/game/SpellAuras.cpp

    r283 r284  
    5050#include "GridNotifiersImpl.h" 
    5151#include "CellImpl.h" 
    52 #include "TemporarySummon.h" 
    5352 
    5453#define NULL_AURA_SLOT 0xFF 
     
    20252024            return; 
    20262025        } 
    2027  
    2028         // Eye of Kilrogg, unsummon eye when aura is gone 
    2029         if(GetId() == 126 && caster->GetTypeId() == TYPEID_PLAYER && caster->GetCharm()) 
    2030         { 
    2031             ((TemporarySummon*)caster->GetCharm())->UnSummon(); 
    2032             return; 
    2033         } 
    20342026    } 
    20352027 
  • trunk/src/game/SpellEffects.cpp

    r283 r284  
    31513151        case SUMMON_TYPE_POSESSED: 
    31523152        case SUMMON_TYPE_POSESSED2: 
     3153        case SUMMON_TYPE_POSESSED3: 
    31533154            EffectSummonPossessed(i); 
    31543155            break; 
     
    31753176            break; 
    31763177        case SUMMON_TYPE_UNKNOWN1: 
    3177         case SUMMON_TYPE_UNKNOWN2: 
    31783178        case SUMMON_TYPE_UNKNOWN3: 
    31793179        case SUMMON_TYPE_UNKNOWN4: 
  • trunk/src/game/SpellHandler.cpp

    r283 r284  
    3434#include "ScriptCalls.h" 
    3535#include "Totem.h" 
     36#include "TemporarySummon.h" 
    3637 
    3738void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) 
     
    377378                return; 
    378379            } 
     380            else if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&  
     381                (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||  
     382                 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||  
     383                 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 
     384            { 
     385                // Possession is removed in the UnSummon function 
     386                ((TemporarySummon*)_player->GetCharm())->UnSummon(); 
     387            } 
    379388        } 
    380389    } 
  • trunk/src/game/Unit.cpp

    r283 r284  
    4747#include "CellImpl.h" 
    4848#include "Path.h" 
     49#include "TemporarySummon.h" 
    4950 
    5051#include <math.h> 
     
    34123413    if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 
    34133414    { 
     3415        // Unsummon any summoned as possessed creatures on channel interrupt 
     3416        SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo; 
     3417        for (int i = 0; i < 3; i++) 
     3418        { 
     3419            if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&  
     3420                (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||  
     3421                 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||  
     3422                 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 
     3423            { 
     3424                // Possession is removed in the UnSummon function 
     3425                if (GetCharm()) 
     3426                    ((TemporarySummon*)GetCharm())->UnSummon();  
     3427            } 
     3428        } 
     3429 
    34143430        if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 
    34153431            m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); 
     
    97919807 
    97929808CharmInfo::CharmInfo(Unit* unit) 
    9793 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) 
     9809: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false) 
    97949810{ 
    97959811    for(int i =0; i<4; ++i) 
     
    98029818void CharmInfo::InitPetActionBar() 
    98039819{ 
     9820    if (m_barInit) 
     9821        return; 
     9822 
    98049823    // the first 3 SpellOrActions are attack, follow and stay 
    98059824    for(uint32 i = 0; i < 3; i++) 
     
    98169835        PetActionBar[i + 3].SpellOrAction = 0; 
    98179836    } 
    9818 } 
    9819  
    9820 void CharmInfo::InitEmptyActionBar() 
    9821 { 
    9822     for(uint32 x = 1; x < 10; ++x) 
     9837    m_barInit = true; 
     9838} 
     9839 
     9840void CharmInfo::InitEmptyActionBar(bool withAttack) 
     9841{ 
     9842    if (m_barInit) 
     9843        return; 
     9844 
     9845    for(uint32 x = 0; x < 10; ++x) 
    98239846    { 
    98249847        PetActionBar[x].Type = ACT_CAST; 
    98259848        PetActionBar[x].SpellOrAction = 0; 
    98269849    } 
    9827     PetActionBar[0].Type = ACT_COMMAND; 
    9828     PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 
     9850    if (withAttack) 
     9851    { 
     9852        PetActionBar[0].Type = ACT_COMMAND; 
     9853        PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 
     9854    } 
     9855    m_barInit = true; 
    98299856} 
    98309857 
  • trunk/src/game/Unit.h

    r283 r284  
    641641typedef std::list<Player*> SharedVisionList; 
    642642 
    643 struct CharmInfo 
     643struct TRINITY_DLL_SPEC CharmInfo 
    644644{ 
    645645    public: 
     
    658658        void InitCharmCreateSpells(); 
    659659        void InitPetActionBar(); 
    660         void InitEmptyActionBar(); 
     660        void InitEmptyActionBar(bool withAttack = true); 
    661661                                                            //return true if successful 
    662662        bool AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate = ACT_DECIDE); 
     
    672672        ReactStates     m_reactState; 
    673673        uint32          m_petnumber; 
     674        bool            m_barInit; 
    674675}; 
    675676