Changeset 203

Show
Ignore:
Timestamp:
11/19/08 13:45:59 (17 years ago)
Author:
yumileroy
Message:

[svn] Send AttackStart? package when update visibility.
Update DoMeleeAttackIfReady? to support dual wield.
Show player modelid2 instead id3 of triggers. This should fix the bug that gameobject::castspell summon a human model.
Remove the correct flag to make creature attackable. This should fix the bug that Illidan and Magtheridon are unattackable.
Add NullCreatureAI for trinityscript.
Fix channeler's soul transfer.
Some update of black temple scripts.

Original author: megamage
Date: 2008-11-09 14:54:13-06:00

Location:
trunk
Files:
1 added
1 removed
10 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/include/sc_creature.cpp

    r186 r203  
    201201            m_creature->AttackerStateUpdate(m_creature->getVictim()); 
    202202            m_creature->resetAttackTimer(); 
     203        } 
     204    } 
     205    if (m_creature->haveOffhandWeapon() && m_creature->isAttackReady(OFF_ATTACK) && !m_creature->IsNonMeleeSpellCasted(false)) 
     206    { 
     207        //If we are within range melee the target 
     208        if (m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE)) 
     209        { 
     210            m_creature->AttackerStateUpdate(m_creature->getVictim(), OFF_ATTACK); 
     211            m_creature->resetAttackTimer(OFF_ATTACK); 
    203212        } 
    204213    } 
  • trunk/src/bindings/scripts/include/sc_creature.h

    r202 r203  
    182182    void AttackStart(Unit *); 
    183183}; 
     184 
     185struct TRINITY_DLL_DECL NullCreatureAI : public CreatureAI 
     186{ 
     187    NullCreatureAI(Creature* c) : m_creature(c) {} 
     188    ~NullCreatureAI() {} 
     189 
     190    Creature *m_creature; 
     191 
     192    void MoveInLineOfSight(Unit *) {} 
     193    void AttackStart(Unit *) {} 
     194    void EnterEvadeMode() {} 
     195    bool IsVisible(Unit *) const { return false; } 
     196 
     197    void UpdateAI(const uint32) {} 
     198}; 
     199 
    184200#endif 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp

    r186 r203  
    7272#define SPELL_DRAW_SOUL                 40904 // 5k Shadow Damage in front of him. Heals Illidan for 100k health (script effect) 
    7373#define SPELL_PARASITIC_SHADOWFIEND     41917 // DoT of 3k Shadow every 2 seconds. Lasts 10 seconds. (Script effect: Summon 2 parasites once the debuff has ticked off) 
     74#define SPELL_PARASITIC_SHADOWFIEND2    41914 // Used by Parasitic 
    7475#define SPELL_SUMMON_PARASITICS         41915 // Summons 2 Parasitic Shadowfiends on the target. It's supposed to be cast as soon as the Parasitic Shadowfiend debuff is gone, but the spells aren't linked :( 
    7576#define SPELL_AGONIZING_FLAMES          40932 // 4k fire damage initial to target and anyone w/i 5 yards. PHASE 3 ONLY 
     
    554555                { 
    555556                    GlaiveGUID[i] = Glaive->GetGUID(); 
    556                     Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     557                    Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    557558                    Glaive->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); 
    558559                    Glaive->setFaction(m_creature->getFaction()); 
     
    571572                { 
    572573                    GlaiveGUID[i] = Glaive->GetGUID(); 
    573                     Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     574                    Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    574575                    Glaive->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); 
    575576                    Glaive->setFaction(m_creature->getFaction()); 
     
    13381339                        Elite->AddThreat(m_creature, 1000000.0f); 
    13391340                        AttackStart(Elite); 
     1341                        m_creature->AddThreat(Elite, 1000000.0f); 
    13401342                    } 
    13411343                    Timer = 10000 + rand()%6000; 
     
    13501352        } 
    13511353 
    1352         if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) 
     1354        if(!m_creature->SelectHostilTarget() && !m_creature->getVictim()) 
    13531355            return; 
    13541356 
     
    17421744        if( m_creature->isAttackReady() && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE)) 
    17431745        { 
    1744             if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)) 
    1745             { 
    1746                 m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND, true, 0, 0, IllidanGUID); //do not stack 
     1746            if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0) && !m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2, 0)) 
     1747            { 
     1748                m_creature->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack 
    17471749            } 
    17481750            m_creature->AttackerStateUpdate(m_creature->getVictim()); 
     
    19131915 
    19141916    m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135); 
     1917    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN2); 
    19151918    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    19161919    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     
    19271930    switch(summon->GetEntry()) 
    19281931    { 
     1932    case PARASITIC_SHADOWFIEND: 
    19291933    case SHADOW_DEMON: 
    19301934        { 
     
    21592163            m_creature->RemoveAllAuras(); 
    21602164            m_creature->InterruptNonMeleeSpells(false); 
    2161             m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 
     2165            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    21622166            m_creature->GetMotionMaster()->Clear(false); 
    21632167            m_creature->AttackStop(); 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp

    r160 r203  
    2828#define SPELL_MOLTEN_PUNCH          40126 
    2929#define SPELL_HURTFUL_STRIKE        41926 
    30 #define SPELL_MOLTEN_FLAME          40253 
     30#define SPELL_MOLTEN_FLAME          40980 
    3131#define SPELL_VOLCANIC_ERUPTION     40117 
    3232#define SPELL_VOLCANIC_SUMMON       40276 
     
    3636#define CREATURE_STALKER            23095 
    3737 
    38 struct TRINITY_DLL_DECL molten_flameAI : public ScriptedAI 
    39 { 
    40     molten_flameAI(Creature *c) : ScriptedAI(c) 
    41     { 
    42         FlameTimer = 0; 
     38struct TRINITY_DLL_DECL molten_flameAI : public NullCreatureAI 
     39{ 
     40    molten_flameAI(Creature *c) : NullCreatureAI(c) 
     41    { 
    4342        float x, y, z; 
    44         m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    4543        m_creature->GetNearPoint(m_creature, x, y, z, 1, 50, M_PI*2*rand_norm()); 
    4644        m_creature->GetMotionMaster()->MovePoint(0, x, y, z); 
    4745    } 
    48  
    49     uint32 FlameTimer; 
    50  
    51     void Reset() {} 
    52     void Aggro(Unit *who) {} 
    53     void AttackStart(Unit* who) {} 
    54     void MoveInLineOfSight(Unit *who) {} 
    55     void UpdateAI(const uint32 diff) 
    56     { 
    57         if(FlameTimer < diff) 
    58         { 
    59             m_creature->CastSpell(m_creature, SPELL_MOLTEN_FLAME, true); 
    60             FlameTimer = 1000; 
    61         }else FlameTimer -= diff; 
    62     } 
    63 }; 
    64  
    65 struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI 
    66 { 
    67     npc_volcanoAI(Creature *c) : ScriptedAI(c) 
    68     { 
    69         m_creature->CastSpell(m_creature, SPELL_VOLCANIC_ERUPTION, false); 
    70         m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); 
    71         m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    72     } 
    73  
    74     void Reset() {} 
    75     void Aggro(Unit *who) {} 
    76     void AttackStart(Unit* who) {} 
    77     void MoveInLineOfSight(Unit* who) {} 
    78     void UpdateAI(const uint32 diff) {} 
    7946}; 
    8047 
     
    264231} 
    265232 
    266 CreatureAI* GetAI_npc_volcano(Creature *_Creature) 
    267 { 
    268     return new npc_volcanoAI (_Creature); 
    269 } 
    270  
    271233void AddSC_boss_supremus() 
    272234{ 
     
    281243    newscript->GetAI = GetAI_molten_flame; 
    282244    m_scripts[nrscripts++] = newscript; 
    283  
    284     newscript = new Script; 
    285     newscript->Name="npc_volcano"; 
    286     newscript->GetAI = GetAI_npc_volcano; 
    287     m_scripts[nrscripts++] = newscript; 
    288245} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp

    r166 r203  
    228228        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    229229        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     230        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN2); 
    230231        m_creature->addUnitState(UNIT_STAT_STUNNED); 
    231232        m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE_C, true); 
  • trunk/src/game/GameObject.cpp

    r146 r203  
    12831283        trigger->CastSpell(target, spell, true); 
    12841284    } 
    1285 } 
     1285    //trigger->setDeathState(JUST_DIED); 
     1286    //trigger->RemoveCorpse(); 
     1287} 
  • trunk/src/game/Object.cpp

    r178 r203  
    602602                    { 
    603603                        if(target->isGameMaster()) 
    604                             *data << cinfo->Modelid1; 
     604                        { 
     605                            if(cinfo->Modelid2) 
     606                                *data << cinfo->Modelid1; 
     607                            else 
     608                                *data << 17519; // world invisible trigger's model 
     609                        } 
    605610                        else 
    606                             *data << cinfo->Modelid3; 
     611                        { 
     612                            if(cinfo->Modelid2) 
     613                                *data << cinfo->Modelid2; 
     614                            else 
     615                                *data << 11686; // world invisible trigger's model 
     616                        } 
    607617                    } 
    608618                    else 
  • trunk/src/game/Player.cpp

    r200 r203  
    1640716407            // send data at target visibility change (adding to client) 
    1640816408            if((*i)!=this && (*i)->isType(TYPEMASK_UNIT)) 
     16409            { 
    1640916410                SendAuraDurationsForTarget(*i); 
     16411                //if(((Unit*)(*i))->isAlive()) //should be always alive 
     16412                { 
     16413                    if((*i)->GetTypeId()==TYPEID_UNIT) 
     16414                        ((Creature*)(*i))->SendMonsterMoveWithSpeedToCurrentDestination(this); 
     16415                    if(((Unit*)(*i))->getVictim()) 
     16416                        ((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim()); 
     16417                } 
     16418            } 
    1641016419 
    1641116420            i = stealthedUnits.erase(i); 
     
    1738717396            // send data at target visibility change (adding to client) 
    1738817397            if(target!=this && target->isType(TYPEMASK_UNIT)) 
     17398            { 
    1738917399                SendAuraDurationsForTarget((Unit*)target); 
    17390  
    17391             if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isAlive()) 
    17392                 ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this); 
     17400                if(((Unit*)target)->isAlive()) 
     17401                { 
     17402                    if(target->GetTypeId()==TYPEID_UNIT) 
     17403                        ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this); 
     17404                    if(((Unit*)target)->getVictim()) 
     17405                        ((Unit*)target)->SendAttackStart(((Unit*)target)->getVictim()); 
     17406                } 
     17407            } 
    1739317408        } 
    1739417409    } 
  • trunk/src/game/Spell.cpp

    r197 r203  
    10131013            // for delayed spells ignore negative spells (after duel end) for friendly targets 
    10141014            // TODO: this cause soul transfer bugged 
    1015             if(m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id)) 
     1015            if(m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id)) 
    10161016            { 
    10171017                m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); 
  • trunk/src/game/Unit.h

    r186 r203  
    943943        void DeMorph(); 
    944944 
     945        void SendAttackStart(Unit* pVictim);  
    945946        void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); 
    946947        void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); 
     
    13531354    private: 
    13541355        void SendAttackStop(Unit* victim);                  // only from AttackStop(Unit*) 
    1355         void SendAttackStart(Unit* pVictim);                // only from Unit::AttackStart(Unit*) 
     1356        //void SendAttackStart(Unit* pVictim);                // only from Unit::AttackStart(Unit*) 
    13561357 
    13571358        void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, AuraTypeSet const& procAuraTypes, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage, SpellSchoolMask damageSchoolMask );