Changeset 178

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

[svn] Rewrite canSeeOrDetect function.
Minor change on trigger creatures.
Remove some unused hacks in scripts.

Original author: megamage
Date: 2008-11-06 10:27:58-06:00

Location:
trunk
Files:
19 modified

Legend:

Unmodified
Added
Removed
  • trunk/sql/updates/146_world.sql

    r161 r178  
    1 update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336; 
    2  
    31DROP TABLE IF EXISTS `spell_linked_spell`; 
    42CREATE TABLE `spell_linked_spell` ( 
  • trunk/sql/updates/163_world.sql

    r162 r178  
    1 DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, 41126); 
     1DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, 41126, 41376); 
    22-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39992, 39835, 1, 'Needle Spine'); 
    33INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39835, 39968, 1, 'Needle Spine'); 
     4INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41376, 41377, 0, 'Spite'); 
    45INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend'); 
    56INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (41126, 41131, 1, 'Flame Crash'); 
    67 
     8-- molten_flame 
    79UPDATE creature_template SET flags_extra = 128, speed = 1.0 WHERE entry = 23095; 
     10-- volcano 
     11UPDATE creature_template SET spell1 = 40117, flags_extra = 128, scriptname = '' WHERE entry = 23085; 
     12-- flame crash 
     13update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336; 
     14-- blaze 
     15update creature_template set spell1 = 40610, flags_extra = 128, scriptname = '' where entry = 23259; 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp

    r158 r178  
    11/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 
    2  * This program is free software; you can redistribute it and/or modify 
    3  * it under the terms of the GNU General Public License as published by 
    4  * the Free Software Foundation; either version 2 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, 
    8  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    10  * GNU General Public License for more details. 
    11  * 
    12  * You should have received a copy of the GNU General Public License 
    13  * along with this program; if not, write to the Free Software 
    14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    15  */ 
     2* This program is free software; you can redistribute it and/or modify 
     3* it under the terms of the GNU General Public License as published by 
     4* the Free Software Foundation; either version 2 of the License, or 
     5* (at your option) any later version. 
     6* 
     7* This program is distributed in the hope that it will be useful, 
     8* but WITHOUT ANY WARRANTY; without even the implied warranty of 
     9* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     10* GNU General Public License for more details. 
     11* 
     12* You should have received a copy of the GNU General Public License 
     13* along with this program; if not, write to the Free Software 
     14* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     15*/ 
    1616 
    1717/* ScriptData 
     
    383383    uint64 GlaiveGUID[2]; 
    384384 
    385     std::list<uint64> ParasiteTargets; // for safety, do not use Unit* 
    386  
    387385    void Reset(); 
    388386 
     
    434432    void Aggro(Unit *who) 
    435433    { 
     434        m_creature->setActive(true); 
    436435        DoZoneInCombat(); 
    437436    } 
     
    502501            m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); 
    503502        } 
    504     } 
    505  
    506     void AddParasiteTarget(uint64 targetGUID) 
    507     { 
    508         for(std::list<uint64>::iterator tIter = ParasiteTargets.begin(); tIter != ParasiteTargets.end(); tIter++) 
    509         { 
    510             if(*tIter == targetGUID) 
    511                 return; 
    512         } 
    513         ParasiteTargets.push_back(targetGUID); 
    514  
    515         if(Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV) 
    516             Timer[EVENT_PARASITE_CHECK] += 1000; 
    517503    } 
    518504 
     
    563549        case 1://lift off 
    564550            m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); 
    565             //m_creature->GetMotionMaster()->Clear(false); 
    566551            m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); 
    567             //m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ()); 
    568552            m_creature->StopMoving(); 
    569553            DoYell(SAY_TAKEOFF, LANG_UNIVERSAL, NULL); 
     
    572556            break; 
    573557        case 2://move to center 
    574             //m_creature->GetMotionMaster()->Clear(false); 
    575             //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    576558            m_creature->GetMotionMaster()->MovePoint(0, CENTER_X + 5, CENTER_Y, CENTER_Z); //+5, for SPELL_THROW_GLAIVE bug 
    577             //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    578559            Timer[EVENT_FLIGHT_SEQUENCE] = 0; 
    579560            break; 
     
    615596            break; 
    616597        case 6://fly to hover point 
    617             //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    618598            m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 
    619             //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    620599            Timer[EVENT_FLIGHT_SEQUENCE] = 0; 
    621600            break; 
    622601        case 7://return to center 
    623             //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    624602            m_creature->GetMotionMaster()->MovePoint(0, CENTER_X, CENTER_Y, CENTER_Z); 
    625             //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    626603            Timer[EVENT_FLIGHT_SEQUENCE] = 0; 
    627604            break; 
     
    642619            break; 
    643620        case 9://land 
    644             //m_creature->GetMotionMaster()->Clear(false); 
    645621            m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); 
    646             //m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ()); 
    647622            m_creature->StopMoving(); 
    648623            m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); 
     
    664639            DoResetThreat(); 
    665640            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 
    666             //m_creature->GetMotionMaster()->Clear(); 
    667641            m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); 
    668642            EnterPhase(PHASE_NORMAL_2); 
     
    724698    void UpdateAI(const uint32 diff) 
    725699    { 
    726         if((!m_creature->SelectHostilTarget() || !m_creature->getVictim()) && Phase < PHASE_TALK_SEQUENCE) 
     700        if((!m_creature->SelectHostilTarget() && !m_creature->getVictim()) && Phase < PHASE_TALK_SEQUENCE) 
    727701            return; 
    728702 
    729703        Event = EVENT_NULL; 
    730704        for(uint32 i = 1; i <= MaxTimer[Phase]; i++) 
     705        { 
    731706            if(Timer[i]) 
    732707                if(Timer[i] <= diff) 
     
    736711                } 
    737712                else Timer[i] -= diff; 
    738  
    739                 switch(Phase) 
     713        } 
     714 
     715        switch(Phase) 
     716        { 
     717        case PHASE_NORMAL: 
     718            if(HPPCT(m_creature) < 65) 
     719                EnterPhase(PHASE_FLIGHT_SEQUENCE); 
     720            break; 
     721 
     722        case PHASE_NORMAL_2: 
     723            if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) 
     724                EnterPhase(PHASE_TALK_SEQUENCE); 
     725            break; 
     726 
     727        case PHASE_NORMAL_MAIEV: 
     728            if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 1) 
     729                EnterPhase(PHASE_TALK_SEQUENCE); 
     730            break; 
     731 
     732        case PHASE_TALK_SEQUENCE: 
     733            if(Event == EVENT_TALK_SEQUENCE) 
     734                HandleTalkSequence(); 
     735            break; 
     736 
     737        case PHASE_FLIGHT_SEQUENCE: 
     738            if(Event == EVENT_FLIGHT_SEQUENCE) 
     739                HandleFlightSequence(); 
     740            break; 
     741 
     742        case PHASE_TRANSFORM_SEQUENCE: 
     743            if(Event == EVENT_TRANSFORM_SEQUENCE) 
     744                HandleTransformSequence(); 
     745            break; 
     746        } 
     747 
     748        if(m_creature->IsNonMeleeSpellCasted(false)) 
     749            return; 
     750 
     751        if(Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !m_creature->HasAura(SPELL_CAGED, 0)) 
     752        { 
     753            switch(Event) 
     754            { 
     755                //PHASE_NORMAL 
     756            case EVENT_BERSERK: 
     757                DoYell(SAY_ENRAGE, LANG_UNIVERSAL, NULL); 
     758                DoPlaySoundToSet(m_creature, SOUND_ENRAGE); 
     759                DoCast(m_creature, SPELL_BERSERK, true); 
     760                Timer[EVENT_BERSERK] = 5000;//The buff actually lasts forever. 
     761                break; 
     762 
     763            case EVENT_TAUNT: 
    740764                { 
    741                 case PHASE_NORMAL: 
    742                     if(HPPCT(m_creature) < 65) 
    743                         EnterPhase(PHASE_FLIGHT_SEQUENCE); 
    744                     break; 
    745  
    746                 case PHASE_NORMAL_2: 
    747                     if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) 
    748                         EnterPhase(PHASE_TALK_SEQUENCE); 
    749                     break; 
    750  
    751                 case PHASE_NORMAL_MAIEV: 
    752                     if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 1) 
    753                         EnterPhase(PHASE_TALK_SEQUENCE); 
    754                     break; 
    755  
    756                 case PHASE_TALK_SEQUENCE: 
    757                     if(Event == EVENT_TALK_SEQUENCE) 
    758                         HandleTalkSequence(); 
    759                     break; 
    760  
    761                 case PHASE_FLIGHT_SEQUENCE: 
    762                     if(Event == EVENT_FLIGHT_SEQUENCE) 
    763                         HandleFlightSequence(); 
    764                     break; 
    765  
    766                 case PHASE_TRANSFORM_SEQUENCE: 
    767                     if(Event == EVENT_TRANSFORM_SEQUENCE) 
    768                         HandleTransformSequence(); 
    769                     break; 
     765                    uint32 random = rand()%4; 
     766                    char* yell = RandomTaunts[random].text; 
     767                    uint32 soundid = RandomTaunts[random].sound; 
     768                    if(yell) 
     769                        DoYell(yell, LANG_UNIVERSAL, NULL); 
     770                    if(soundid) 
     771                        DoPlaySoundToSet(m_creature, soundid); 
    770772                } 
    771  
    772                 if(m_creature->IsNonMeleeSpellCasted(false)) 
    773                     return; 
    774  
    775                 if(Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !m_creature->HasAura(SPELL_CAGED, 0)) 
     773                Timer[EVENT_TAUNT] = 32000; 
     774                break; 
     775 
     776            case EVENT_SHEAR: 
     777                DoCast(m_creature->getVictim(), SPELL_SHEAR); 
     778                Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000); 
     779                break; 
     780 
     781            case EVENT_FLAME_CRASH: 
     782                DoCast(m_creature->getVictim(), SPELL_FLAME_CRASH); 
     783                Timer[EVENT_FLAME_CRASH] = 35000; 
     784                break; 
     785 
     786            case EVENT_PARASITIC_SHADOWFIEND: 
    776787                { 
    777                     switch(Event) 
    778                     { 
    779                         //PHASE_NORMAL 
    780                     case EVENT_BERSERK: 
    781                         DoYell(SAY_ENRAGE, LANG_UNIVERSAL, NULL); 
    782                         DoPlaySoundToSet(m_creature, SOUND_ENRAGE); 
    783                         DoCast(m_creature, SPELL_BERSERK, true); 
    784                         Timer[EVENT_BERSERK] = 5000;//The buff actually lasts forever. 
    785                         break; 
    786  
    787                     case EVENT_TAUNT: 
    788                         { 
    789                             uint32 random = rand()%4; 
    790                             char* yell = RandomTaunts[random].text; 
    791                             uint32 soundid = RandomTaunts[random].sound; 
    792                             if(yell) 
    793                                 DoYell(yell, LANG_UNIVERSAL, NULL); 
    794                             if(soundid) 
    795                                 DoPlaySoundToSet(m_creature, soundid); 
    796                         } 
    797                         Timer[EVENT_TAUNT] = 32000; 
    798                         break; 
    799  
    800                     case EVENT_SHEAR: 
    801                         DoCast(m_creature->getVictim(), SPELL_SHEAR); 
    802                         Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000); 
    803                         break; 
    804  
    805                     case EVENT_FLAME_CRASH: 
    806                         DoCast(m_creature->getVictim(), SPELL_FLAME_CRASH); 
    807                         Timer[EVENT_FLAME_CRASH] = 35000; 
    808                         break; 
    809  
    810                     case EVENT_PARASITIC_SHADOWFIEND: 
    811                         { 
    812                             Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); 
    813                             if(!target) target = m_creature->getVictim(); 
    814                             if(target->GetTypeId() == TYPEID_PLAYER && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)) 
    815                             { 
    816                                 target->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, true); // do not miss 
    817                                 ParasiteTargets.push_back(target->GetGUID()); 
    818                                 Timer[EVENT_PARASITE_CHECK] += 1000; // do not check immediately 
    819                             } 
    820                             Timer[EVENT_PARASITIC_SHADOWFIEND] = 40000; 
    821                         } 
    822                         break; 
    823  
    824                     case EVENT_PARASITE_CHECK: 
    825                         for(std::list<uint64>::iterator tIter = ParasiteTargets.begin(); tIter != ParasiteTargets.end();) 
    826                         { 
    827                             Unit* target = Unit::GetUnit((*m_creature), *tIter); 
    828                             if(!target || !target->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)) 
    829                             { 
    830                                 if(target && target->isAlive()) 
    831                                     target->CastSpell(target, SPELL_SUMMON_PARASITICS, true); 
    832                                 std::list<uint64>::iterator tIter2 = tIter; 
    833                                 ++tIter; 
    834                                 ParasiteTargets.erase(tIter2); 
    835                             } 
    836                             else 
    837                                 ++tIter; 
    838                         } 
    839                         if(ParasiteTargets.empty()) 
    840                             Timer[EVENT_PARASITE_CHECK] = 0; 
    841                         else 
    842                             Timer[EVENT_PARASITE_CHECK] = 1000; 
    843                         break; 
    844  
    845                     case EVENT_DRAW_SOUL: 
    846                         DoCast(m_creature->getVictim(), SPELL_DRAW_SOUL); 
    847                         Timer[EVENT_DRAW_SOUL] = 55000;           
    848                         break; 
    849  
    850                         //PHASE_NORMAL_2 
    851                     case EVENT_AGONIZING_FLAMES: 
    852                         DoCast(SelectUnit(SELECT_TARGET_RANDOM,0), SPELL_AGONIZING_FLAMES); 
    853                         Timer[EVENT_AGONIZING_FLAMES] = 0; 
    854                         break; 
    855  
    856                     case EVENT_TRANSFORM_NORMAL: 
    857                         EnterPhase(PHASE_TRANSFORM_SEQUENCE); 
    858                         break; 
    859  
    860                         //PHASE_NORMAL_MAIEV 
    861                     case EVENT_ENRAGE: 
    862                         DoCast(m_creature, SPELL_ENRAGE); 
    863                         Timer[EVENT_ENRAGE] = 0; 
    864                         break; 
    865  
    866                     default: 
    867                         break; 
    868                     } 
    869                     DoMeleeAttackIfReady(); 
     788                    Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1, 200, true); 
     789                    if(!target) target = m_creature->getVictim(); 
     790                    if(target) 
     791                        m_creature->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, true); 
     792                }break; 
     793 
     794            case EVENT_PARASITE_CHECK: 
     795                Timer[EVENT_PARASITE_CHECK] = 0; 
     796                break; 
     797 
     798            case EVENT_DRAW_SOUL: 
     799                DoCast(m_creature->getVictim(), SPELL_DRAW_SOUL); 
     800                Timer[EVENT_DRAW_SOUL] = 55000;           
     801                break; 
     802 
     803                //PHASE_NORMAL_2 
     804            case EVENT_AGONIZING_FLAMES: 
     805                DoCast(SelectUnit(SELECT_TARGET_RANDOM,0), SPELL_AGONIZING_FLAMES); 
     806                Timer[EVENT_AGONIZING_FLAMES] = 0; 
     807                break; 
     808 
     809            case EVENT_TRANSFORM_NORMAL: 
     810                EnterPhase(PHASE_TRANSFORM_SEQUENCE); 
     811                break; 
     812 
     813                //PHASE_NORMAL_MAIEV 
     814            case EVENT_ENRAGE: 
     815                DoCast(m_creature, SPELL_ENRAGE); 
     816                Timer[EVENT_ENRAGE] = 0; 
     817                break; 
     818 
     819            default: 
     820                break; 
     821            } 
     822            DoMeleeAttackIfReady(); 
     823        } 
     824 
     825        if(Phase == PHASE_FLIGHT) 
     826        { 
     827            switch(Event) 
     828            { 
     829            case EVENT_FIREBALL: 
     830                DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); 
     831                Timer[EVENT_FIREBALL] = 3000; 
     832                break; 
     833 
     834            case EVENT_DARK_BARRAGE: 
     835                DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DARK_BARRAGE); 
     836                Timer[EVENT_DARK_BARRAGE] = 0; 
     837                break; 
     838 
     839            case EVENT_EYE_BLAST: 
     840                CastEyeBlast();  
     841                Timer[EVENT_EYE_BLAST] = 0; 
     842                break; 
     843 
     844            case EVENT_MOVE_POINT: 
     845                Phase = PHASE_FLIGHT_SEQUENCE; 
     846                Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point 
     847                for (uint8 i = 0; i <= rand()%3; i++) 
     848                { 
     849                    HoverPoint++; 
     850                    if(HoverPoint > 3) 
     851                        HoverPoint = 0; 
    870852                } 
    871  
    872                 if(Phase == PHASE_FLIGHT) 
    873                 { 
    874                     switch(Event) 
    875                     { 
    876                     case EVENT_FIREBALL: 
    877                         DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); 
    878                         Timer[EVENT_FIREBALL] = 3000; 
    879                         break; 
    880  
    881                     case EVENT_DARK_BARRAGE: 
    882                         DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DARK_BARRAGE); 
    883                         Timer[EVENT_DARK_BARRAGE] = 0; 
    884                         break; 
    885  
    886                     case EVENT_EYE_BLAST: 
    887                         CastEyeBlast();  
    888                         Timer[EVENT_EYE_BLAST] = 0; 
    889                         break; 
    890  
    891                     case EVENT_MOVE_POINT: 
    892                         Phase = PHASE_FLIGHT_SEQUENCE; 
    893                         Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point 
    894                         for (uint8 i = 0; i <= rand()%3; i++) 
    895                         { 
    896                             HoverPoint++; 
    897                             if(HoverPoint > 3) 
    898                                 HoverPoint = 0; 
    899                         } 
    900                         m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    901                         m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 
    902                         m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); 
    903                         break; 
    904  
    905                     default: 
    906                         break; 
    907                     } 
    908                 } 
    909  
    910                 if(Phase == PHASE_DEMON) 
    911                 { 
    912                     switch(Event) 
    913                     { 
    914                     case EVENT_SHADOW_BLAST: 
    915                         m_creature->GetMotionMaster()->Clear(false); 
    916                         if(!m_creature->IsWithinDistInMap(m_creature->getVictim(), 50)||!m_creature->IsWithinLOSInMap(m_creature->getVictim())) 
    917                             m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), 30); 
    918                         else 
    919                             m_creature->GetMotionMaster()->MoveIdle(); 
    920                         DoCast(m_creature->getVictim(), SPELL_SHADOW_BLAST); 
    921                         Timer[EVENT_SHADOW_BLAST] = 4000; 
    922                         break; 
    923                     case EVENT_SHADOWDEMON: 
    924                         DoCast(m_creature, SPELL_SUMMON_SHADOWDEMON); 
    925                         Timer[EVENT_SHADOWDEMON] = 0; 
    926                         Timer[EVENT_FLAME_BURST] += 10000; 
    927                         break; 
    928                     case EVENT_FLAME_BURST: 
    929                         DoCast(m_creature, SPELL_FLAME_BURST); 
    930                         Timer[EVENT_FLAME_BURST] = 15000; 
    931                         break; 
    932                     case EVENT_TRANSFORM_DEMON: 
    933                         EnterPhase(PHASE_TRANSFORM_SEQUENCE); 
    934                         break; 
    935                     default: 
    936                         break; 
    937                     } 
    938                 } 
     853                m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 
     854                break; 
     855 
     856            default: 
     857                break; 
     858            } 
     859        } 
     860 
     861        if(Phase == PHASE_DEMON) 
     862        { 
     863            switch(Event) 
     864            { 
     865            case EVENT_SHADOW_BLAST: 
     866                m_creature->GetMotionMaster()->Clear(false); 
     867                if(!m_creature->IsWithinDistInMap(m_creature->getVictim(), 50)||!m_creature->IsWithinLOSInMap(m_creature->getVictim())) 
     868                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), 30); 
     869                else 
     870                    m_creature->GetMotionMaster()->MoveIdle(); 
     871                DoCast(m_creature->getVictim(), SPELL_SHADOW_BLAST); 
     872                Timer[EVENT_SHADOW_BLAST] = 4000; 
     873                break; 
     874            case EVENT_SHADOWDEMON: 
     875                DoCast(m_creature, SPELL_SUMMON_SHADOWDEMON); 
     876                Timer[EVENT_SHADOWDEMON] = 0; 
     877                Timer[EVENT_FLAME_BURST] += 10000; 
     878                break; 
     879            case EVENT_FLAME_BURST: 
     880                DoCast(m_creature, SPELL_FLAME_BURST); 
     881                Timer[EVENT_FLAME_BURST] = 15000; 
     882                break; 
     883            case EVENT_TRANSFORM_DEMON: 
     884                EnterPhase(PHASE_TRANSFORM_SEQUENCE); 
     885                break; 
     886            default: 
     887                break; 
     888            } 
     889        } 
    939890    } 
    940891}; 
    941892 
    942893/********************************** End of Illidan AI ******************************************/ 
    943  
    944 //This is used to sort the players by distance in preparation for being charged by the flames. 
    945 struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit, bool> 
    946 { 
    947     const Unit* MainTarget; 
    948     TargetDistanceOrder(const Unit* Target) : MainTarget(Target) {}; 
    949     // functor for operator ">" 
    950     bool operator()(const Unit* _Left, const Unit* _Right) const 
    951     { 
    952         return (MainTarget->GetDistance(_Left) > MainTarget->GetDistance(_Right)); 
    953     } 
    954 }; 
    955894 
    956895struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI 
     
    973912    void ChargeCheck() 
    974913    {         
    975         // Get the Threat List 
    976         std::list<HostilReference *> m_threatlist = m_creature->getThreatManager().getThreatList(); 
    977  
    978         if(!m_threatlist.size()) return; // He doesn't have anyone in his threatlist, useless to continue 
    979  
    980         std::list<Unit *> targets; 
    981         std::list<HostilReference *>::iterator itr = m_threatlist.begin(); 
    982         for( ; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container 
    983         { 
    984             Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); 
    985             if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER && target->GetPositionZ()>350) //only on alive players 
    986                 targets.push_back(target); 
    987         } 
    988  
    989         if (!targets.size()) 
    990             return; 
    991  
    992         //Sort the list of players 
    993         targets.sort(TargetDistanceOrder(m_creature)); 
    994         //Resize so we only get the furthest target 
    995         targets.resize(1); 
    996  
    997         Unit* target = (*targets.begin()); 
     914        Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0, 200, false); 
    998915        if(target && (!m_creature->IsWithinDistInMap(target, FLAME_CHARGE_DISTANCE))) 
    999916        { 
     
    11291046        m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has strange values.. 
    11301047        m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); 
     1048        m_creature->setActive(false); 
    11311049    } 
    11321050 
     
    11851103    void BeginChannel() 
    11861104    { 
     1105        m_creature->setActive(true); 
     1106 
    11871107        float x, y, z; 
    11881108        if(GETGO(Gate, GateGUID)) 
     
    15281448            m_creature->InterruptNonMeleeSpells(false); 
    15291449            m_creature->GetMotionMaster()->Clear(false); 
    1530             //m_creature->GetMotionMaster()->MoveIdle(); 
    15311450            m_creature->AttackStop(); 
    15321451            m_creature->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); 
     
    15581477        m_creature->InterruptNonMeleeSpells(false); 
    15591478        m_creature->GetMotionMaster()->Clear(false); 
    1560         //m_creature->GetMotionMaster()->MoveIdle(); 
    15611479        m_creature->Relocate(x, y, z); 
    15621480        m_creature->SendMonsterMove(x, y, z, 0, 0, 0); 
     
    18401758            if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)) 
    18411759            { 
    1842                 m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND, true); //do not stack 
    1843                 if(GETCRE(Illidan, IllidanGUID)) 
    1844                     ((boss_illidan_stormrageAI*)Illidan->AI())->AddParasiteTarget(m_creature->getVictim()->GetGUID()); 
     1760                m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND, true, 0, 0, IllidanGUID); //do not stack 
    18451761            } 
    18461762            m_creature->AttackerStateUpdate(m_creature->getVictim()); 
     
    19371853}; 
    19381854 
    1939 struct TRINITY_DLL_DECL blazeAI : public ScriptedAI 
    1940 { 
    1941     blazeAI(Creature *c) : ScriptedAI(c) {Reset();} 
    1942  
    1943     uint32 BlazeTimer; 
    1944     uint32 DespawnTimer; 
    1945  
    1946     void Reset() 
    1947     { 
    1948         BlazeTimer = 3000;   
    1949         DespawnTimer = 60000; // Spell duration = 1 min 
    1950         //((TemporarySummon*)m_creature)->Summon(TEMPSUMMON_TIMED_DESPAWN, 0, false); 
    1951     } 
    1952  
    1953     void Aggro(Unit *who) {} 
    1954     void AttackStart(Unit* who) { } 
    1955     void MoveInLineOfSight(Unit *who){ } 
    1956  
    1957     void UpdateAI(const uint32 diff) 
    1958     { 
    1959         if(BlazeTimer) 
    1960             if(BlazeTimer <= diff) 
    1961             { 
    1962                 DoCast(m_creature, SPELL_BLAZE_EFFECT);//duration 60s 
    1963                 BlazeTimer = 0; 
    1964             }else BlazeTimer -= diff; 
    1965  
    1966         if(DespawnTimer < diff) 
    1967         { 
    1968             m_creature->SetVisibility(VISIBILITY_OFF); 
    1969             m_creature->setDeathState(JUST_DIED); 
    1970         }else DespawnTimer -= diff; 
    1971     } 
    1972 }; 
    1973  
    1974 struct TRINITY_DLL_DECL flamecrashAI : public ScriptedAI 
    1975 { 
    1976     flamecrashAI(Creature *c) : ScriptedAI(c) {Reset();} 
    1977  
    1978     uint32 DespawnTimer; 
    1979  
    1980     void Reset() 
    1981     { 
    1982         DoCast(m_creature, SPELL_FLAME_CRASH_EFFECT);//duration inf 
    1983         DespawnTimer = 120000; // summon spell duration 
    1984     } 
    1985  
    1986     void Aggro(Unit *who) {} 
    1987     void AttackStart(Unit *who) { } 
    1988     void MoveInLineOfSight(Unit *who){ } 
    1989  
    1990     void UpdateAI(const uint32 diff) 
    1991     { 
    1992         if(DespawnTimer < diff) 
    1993         { 
    1994             m_creature->SetVisibility(VISIBILITY_OFF); 
    1995             m_creature->setDeathState(JUST_DIED); 
    1996         }else DespawnTimer -= diff; 
    1997     } 
    1998 }; 
    1999  
    20001855struct TRINITY_DLL_DECL blade_of_azzinothAI : public ScriptedAI 
    20011856{ 
     
    20701925    FlightCount = 0; 
    20711926    TransformCount = 0; 
    2072  
    2073     ParasiteTargets.clear(); 
    20741927 
    20751928    m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135); 
     
    20811934 
    20821935    m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); 
     1936    m_creature->setActive(false); 
    20831937} 
    20841938 
     
    23782232} 
    23792233 
    2380 CreatureAI* GetAI_flamecrash(Creature *_Creature) 
    2381 { 
    2382     return new flamecrashAI (_Creature); 
    2383 } 
    2384  
    23852234CreatureAI* GetAI_demonfire(Creature *_Creature) 
    23862235{ 
    23872236    return new demonfireAI (_Creature); 
    2388 } 
    2389  
    2390 CreatureAI* GetAI_blaze(Creature *_Creature) 
    2391 { 
    2392     return new blazeAI (_Creature); 
    23932237} 
    23942238 
     
    24502294 
    24512295    newscript = new Script; 
    2452     newscript->Name="mob_flame_crash"; 
    2453     newscript->GetAI = GetAI_flamecrash; 
    2454     m_scripts[nrscripts++] = newscript; 
    2455  
    2456     newscript = new Script; 
    24572296    newscript->Name="mob_demon_fire"; 
    24582297    newscript->GetAI = GetAI_demonfire; 
    2459     m_scripts[nrscripts++] = newscript; 
    2460  
    2461     newscript = new Script; 
    2462     newscript->Name="mob_blaze"; 
    2463     newscript->GetAI = GetAI_blaze; 
    24642298    m_scripts[nrscripts++] = newscript; 
    24652299 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp

    r90 r178  
    635635    } 
    636636 
    637     void SelectSpiteTarget(uint32 num, float max_range = 999) 
    638     { 
    639         if(!num) return; 
    640  
    641         CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); 
    642         Cell cell(p); 
    643         cell.data.Part.reserved = ALL_DISTRICT; 
    644         cell.SetNoCreate(); 
    645  
    646         std::list<Unit *> tempUnitMap; 
    647  
    648         { 
    649             Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(m_creature, m_creature, max_range); 
    650             Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); 
    651  
    652             TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); 
    653             TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer >  grid_unit_searcher(searcher); 
    654  
    655             CellLock<GridReadGuard> cell_lock(cell, p); 
    656             cell_lock->Visit(cell_lock, world_unit_searcher, *(m_creature->GetMap())); 
    657             cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); 
    658         } 
    659  
    660         std::list<Unit*>::iterator itr; 
    661         while(tempUnitMap.size() && SpiteTargetGUID.size() < num) 
    662         { 
    663             itr = tempUnitMap.begin(); 
    664             advance(itr, rand()%tempUnitMap.size()); 
    665             SpiteTargetGUID.push_back((*itr)->GetGUID()); 
    666             tempUnitMap.erase(itr); 
    667         } 
    668  
    669         for(itr = tempUnitMap.begin(); itr != tempUnitMap.end(); ++itr) 
    670             (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    671         m_creature->CastSpell(m_creature, SPELL_SPITE_TARGET, true); // must true 
    672         for(itr = tempUnitMap.begin(); itr != tempUnitMap.end(); ++itr) 
    673             (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    674     } 
    675  
    676637    void UpdateAI(const uint32 diff) 
    677638    { 
     
    701662        { 
    702663            DoCast(m_creature->getVictim(), SPELL_SOUL_SCREAM); 
    703             SoulScreamTimer = 10000; 
     664            SoulScreamTimer = 9000 + rand()%2000; 
    704665            if(!(rand()%3)) 
    705666            { 
     
    711672        if(SpiteTimer < diff) 
    712673        { 
    713             if(!SpiteTargetGUID.empty()) 
    714             { 
    715                 for (std::list<uint64>::iterator itr = SpiteTargetGUID.begin(); itr != SpiteTargetGUID.end(); ++itr) 
    716                 { 
    717                     if(Unit* target = Unit::GetUnit(*m_creature, *itr)) 
    718                     { 
    719                         target->RemoveAurasDueToSpell(SPELL_SPITE_TARGET); 
    720                         m_creature->CastSpell(target, SPELL_SPITE_DAMAGE, true); 
    721                     } 
    722                 } 
    723                 SpiteTargetGUID.clear(); 
    724                 SpiteTimer = 24000; 
    725             } 
    726             else 
    727             { 
    728                 SelectSpiteTarget(3); 
    729                 SpiteTimer = 6000; 
    730                 DoYell(ANGER_SAY_SPEC,LANG_UNIVERSAL,NULL); 
    731                 DoPlaySoundToSet(m_creature, ANGER_SOUND_SPEC); 
    732             } 
     674            DoCast(m_creature, SPELL_SPITE_TARGET); 
     675            SpiteTimer = 30000; 
     676            DoYell(ANGER_SAY_SPEC,LANG_UNIVERSAL,NULL); 
     677            DoPlaySoundToSet(m_creature, ANGER_SOUND_SPEC); 
    733678        }else SpiteTimer -= diff; 
    734679 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp

    r90 r178  
    11/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 
    2  * This program is free software; you can redistribute it and/or modify 
    3  * it under the terms of the GNU General Public License as published by 
    4  * the Free Software Foundation; either version 2 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, 
    8  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    10  * GNU General Public License for more details. 
    11  * 
    12  * You should have received a copy of the GNU General Public License 
    13  * along with this program; if not, write to the Free Software 
    14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    15  */ 
     2* This program is free software; you can redistribute it and/or modify 
     3* it under the terms of the GNU General Public License as published by 
     4* the Free Software Foundation; either version 2 of the License, or 
     5* (at your option) any later version. 
     6* 
     7* This program is distributed in the hope that it will be useful, 
     8* but WITHOUT ANY WARRANTY; without even the implied warranty of 
     9* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     10* GNU General Public License for more details. 
     11* 
     12* You should have received a copy of the GNU General Public License 
     13* along with this program; if not, write to the Free Software 
     14* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     15*/ 
    1616 
    1717/* ScriptData 
     
    5656    uint64 IllidanStormrage; 
    5757 
    58        uint16 BossKilled; 
     58    uint16 BossKilled; 
    5959 
    6060    uint64 NajentusGate; 
    6161    uint64 MainTempleDoors; 
    62        uint64 ShadeOfAkamaDoor; 
    63        uint64 CommonDoor;//Teron 
    64        uint64 TeronDoor; 
    65        uint64 GuurtogDoor; 
    66        uint64 MotherDoor; 
    67        uint64 TempleDoor;//Befor mother 
    68        uint64 CouncilDoor; 
    69        uint64 SimpleDoor;//council 
     62    uint64 ShadeOfAkamaDoor; 
     63    uint64 CommonDoor;//Teron 
     64    uint64 TeronDoor; 
     65    uint64 GuurtogDoor; 
     66    uint64 MotherDoor; 
     67    uint64 TempleDoor;//Befor mother 
     68    uint64 CouncilDoor; 
     69    uint64 SimpleDoor;//council 
    7070    uint64 IllidanGate; 
    7171    uint64 IllidanDoor[2]; 
    72  
    7372 
    7473    uint32 Encounters[ENCOUNTERS]; 
     
    8988        IllidanStormrage = 0; 
    9089 
    91                BossKilled = 0; 
     90        BossKilled = 0; 
    9291 
    9392        NajentusGate    = 0; 
    9493        MainTempleDoors = 0; 
    95                ShadeOfAkamaDoor= 0; 
    96                CommonDoor              = 0;//teron 
    97                TeronDoor               = 0; 
    98                GuurtogDoor             = 0; 
    99                MotherDoor              = 0; 
    100                TempleDoor              = 0; 
    101                SimpleDoor              = 0;//Bycouncil 
    102                CouncilDoor             = 0; 
     94        ShadeOfAkamaDoor= 0; 
     95        CommonDoor              = 0;//teron 
     96        TeronDoor               = 0; 
     97        GuurtogDoor             = 0; 
     98        MotherDoor              = 0; 
     99        TempleDoor              = 0; 
     100        SimpleDoor              = 0;//Bycouncil 
     101        CouncilDoor             = 0; 
    103102        IllidanGate     = 0; 
    104103        IllidanDoor[0]  = 0; 
     
    119118    void OpenDoor(uint64 DoorGUID, bool open) 
    120119    { 
    121         if(((InstanceMap*)instance)->GetPlayers().size()) 
    122             if(Player* first = ((InstanceMap*)instance)->GetPlayers().front()) 
    123                 if(GameObject *Door = GameObject::GetGameObject(*first, DoorGUID)) 
    124                     Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); 
    125     } 
    126  
    127        void CloseDoor(uint64 DoorGUID, bool close) 
    128        { 
    129                if(((InstanceMap*)instance)->GetPlayers().size()) 
    130             if(Player* first = ((InstanceMap*)instance)->GetPlayers().front()) 
    131                 if(GameObject *Door = GameObject::GetGameObject(*first, DoorGUID)) 
    132                     Door->SetUInt32Value(GAMEOBJECT_STATE, close ? 1 : 0); 
    133        } 
    134  
    135  
     120        if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) 
     121            Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); 
     122    } 
     123 
     124    void CloseDoor(uint64 DoorGUID, bool close) 
     125    { 
     126        if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) 
     127            Door->SetUInt32Value(GAMEOBJECT_STATE, close ? 1 : 0); 
     128    } 
    136129 
    137130    void OnCreatureCreate(Creature *creature, uint32 creature_entry) 
     
    139132        switch(creature_entry) 
    140133        { 
    141             case 22887:    Najentus = creature->GetGUID();                  break; 
    142             case 23089:    Akama = creature->GetGUID();                     break; 
    143             case 22990:    Akama_Shade = creature->GetGUID();               break; 
    144             case 22841:    ShadeOfAkama = creature->GetGUID();              break; 
    145             case 22898:    Supremus = creature->GetGUID();                  break; 
    146             case 22917:    IllidanStormrage = creature->GetGUID();          break; 
    147             case 22949:    GathiosTheShatterer = creature->GetGUID();       break; 
    148             case 22950:    HighNethermancerZerevor = creature->GetGUID();   break; 
    149             case 22951:    LadyMalande = creature->GetGUID();               break; 
    150             case 22952:    VerasDarkshadow = creature->GetGUID();           break; 
    151             case 23426:    IllidariCouncil = creature->GetGUID();           break; 
    152             case 23499:    BloodElfCouncilVoice = creature->GetGUID();      break; 
     134        case 22887:    Najentus = creature->GetGUID();                  break; 
     135        case 23089:    Akama = creature->GetGUID();                     break; 
     136        case 22990:    Akama_Shade = creature->GetGUID();               break; 
     137        case 22841:    ShadeOfAkama = creature->GetGUID();              break; 
     138        case 22898:    Supremus = creature->GetGUID();                  break; 
     139        case 22917:    IllidanStormrage = creature->GetGUID();          break; 
     140        case 22949:    GathiosTheShatterer = creature->GetGUID();       break; 
     141        case 22950:    HighNethermancerZerevor = creature->GetGUID();   break; 
     142        case 22951:    LadyMalande = creature->GetGUID();               break; 
     143        case 22952:    VerasDarkshadow = creature->GetGUID();           break; 
     144        case 23426:    IllidariCouncil = creature->GetGUID();           break; 
     145        case 23499:    BloodElfCouncilVoice = creature->GetGUID();      break; 
    153146        } 
    154147    } 
     
    158151        switch(go->GetEntry()) 
    159152        { 
    160             case 185483:                                    // Gate past Naj'entus (at the entrance to Supermoose's courtyards) 
    161                 NajentusGate = go->GetGUID();break; 
    162                        case 185882:                                    // Main Temple Doors - right past Supermoose (Supremus) 
    163                 MainTempleDoors = go->GetGUID();break; 
    164                        case 185478: 
    165                                ShadeOfAkamaDoor = go->GetGUID();break; 
    166                        case 185480:  
    167                                        CommonDoor = go->GetGUID();break; 
    168                        case 186153: 
    169                                TeronDoor = go->GetGUID();break; 
    170                        case 185892: 
    171                                GuurtogDoor = go->GetGUID();break; 
    172                        case 185479: 
    173                                TempleDoor = go->GetGUID();break; 
    174                        case 185482: 
    175                                MotherDoor = go->GetGUID();break; 
    176                        case 185481: 
    177                                CouncilDoor = go->GetGUID();break; 
    178                        case 186152://used by council 
    179                                SimpleDoor = go->GetGUID();break; 
    180                        case 185905:                                    // Gate leading to Temple Summit 
    181                 IllidanGate = go->GetGUID(); 
    182                 go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
    183                 break; 
    184                        case 186261:                                    // Right door at Temple Summit 
    185                 IllidanDoor[0] = go->GetGUID(); 
    186                 go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
    187                 break; 
    188                        case 186262:                                    // Left door at Temple Summit 
    189                 IllidanDoor[1] = go->GetGUID(); 
    190                 go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
    191                 break; 
     153        case 185483:                                    // Gate past Naj'entus (at the entrance to Supermoose's courtyards) 
     154            NajentusGate = go->GetGUID();break; 
     155        case 185882:                                    // Main Temple Doors - right past Supermoose (Supremus) 
     156            MainTempleDoors = go->GetGUID();break; 
     157        case 185478: 
     158            ShadeOfAkamaDoor = go->GetGUID();break; 
     159        case 185480:  
     160            CommonDoor = go->GetGUID();break; 
     161        case 186153: 
     162            TeronDoor = go->GetGUID();break; 
     163        case 185892: 
     164            GuurtogDoor = go->GetGUID();break; 
     165        case 185479: 
     166            TempleDoor = go->GetGUID();break; 
     167        case 185482: 
     168            MotherDoor = go->GetGUID();break; 
     169        case 185481: 
     170            CouncilDoor = go->GetGUID();break; 
     171        case 186152://used by council 
     172            SimpleDoor = go->GetGUID();break; 
     173        case 185905:                                    // Gate leading to Temple Summit 
     174            IllidanGate = go->GetGUID(); 
     175            go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
     176            break; 
     177        case 186261:                                    // Right door at Temple Summit 
     178            IllidanDoor[0] = go->GetGUID(); 
     179            go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
     180            break; 
     181        case 186262:                                    // Left door at Temple Summit 
     182            IllidanDoor[1] = go->GetGUID(); 
     183            go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); 
     184            break; 
    192185        } 
    193186    } 
     
    197190        switch(identifier) 
    198191        { 
    199             case DATA_HIGHWARLORDNAJENTUS:         return Najentus; 
    200             case DATA_AKAMA:                       return Akama; 
    201             case DATA_AKAMA_SHADE:                 return Akama_Shade; 
    202             case DATA_SHADEOFAKAMA:                return ShadeOfAkama; 
    203             case DATA_SUPREMUS:                    return Supremus; 
    204             case DATA_ILLIDANSTORMRAGE:            return IllidanStormrage; 
    205             case DATA_GATHIOSTHESHATTERER:         return GathiosTheShatterer; 
    206             case DATA_HIGHNETHERMANCERZEREVOR:     return HighNethermancerZerevor; 
    207             case DATA_LADYMALANDE:                 return LadyMalande; 
    208             case DATA_VERASDARKSHADOW:             return VerasDarkshadow; 
    209             case DATA_ILLIDARICOUNCIL:             return IllidariCouncil; 
    210             case DATA_GAMEOBJECT_NAJENTUS_GATE:    return NajentusGate; 
    211             case DATA_GAMEOBJECT_ILLIDAN_GATE:     return IllidanGate; 
    212             case DATA_GAMEOBJECT_ILLIDAN_DOOR_R:   return IllidanDoor[0]; 
    213             case DATA_GAMEOBJECT_ILLIDAN_DOOR_L:   return IllidanDoor[1]; 
    214             case DATA_GAMEOBJECT_SUPREMUS_DOORS:   return MainTempleDoors; 
    215             case DATA_BLOOD_ELF_COUNCIL_VOICE:     return BloodElfCouncilVoice; 
     192        case DATA_HIGHWARLORDNAJENTUS:         return Najentus; 
     193        case DATA_AKAMA:                       return Akama; 
     194        case DATA_AKAMA_SHADE:                 return Akama_Shade; 
     195        case DATA_SHADEOFAKAMA:                return ShadeOfAkama; 
     196        case DATA_SUPREMUS:                    return Supremus; 
     197        case DATA_ILLIDANSTORMRAGE:            return IllidanStormrage; 
     198        case DATA_GATHIOSTHESHATTERER:         return GathiosTheShatterer; 
     199        case DATA_HIGHNETHERMANCERZEREVOR:     return HighNethermancerZerevor; 
     200        case DATA_LADYMALANDE:                 return LadyMalande; 
     201        case DATA_VERASDARKSHADOW:             return VerasDarkshadow; 
     202        case DATA_ILLIDARICOUNCIL:             return IllidariCouncil; 
     203        case DATA_GAMEOBJECT_NAJENTUS_GATE:    return NajentusGate; 
     204        case DATA_GAMEOBJECT_ILLIDAN_GATE:     return IllidanGate; 
     205        case DATA_GAMEOBJECT_ILLIDAN_DOOR_R:   return IllidanDoor[0]; 
     206        case DATA_GAMEOBJECT_ILLIDAN_DOOR_L:   return IllidanDoor[1]; 
     207        case DATA_GAMEOBJECT_SUPREMUS_DOORS:   return MainTempleDoors; 
     208        case DATA_BLOOD_ELF_COUNCIL_VOICE:     return BloodElfCouncilVoice; 
    216209        } 
    217210 
     
    223216        switch(type) 
    224217        { 
    225             case DATA_HIGHWARLORDNAJENTUSEVENT:   Encounters[0] = data;                        break; 
    226             case DATA_SUPREMUSEVENT:              Encounters[1] = data;         break; 
    227             case DATA_SHADEOFAKAMAEVENT:          Encounters[2] = data;         break; 
    228             case DATA_TERONGOREFIENDEVENT:        Encounters[3] = data;         break; 
    229             case DATA_GURTOGGBLOODBOILEVENT:      Encounters[4] = data;         break; 
    230             case DATA_RELIQUARYOFSOULSEVENT:      Encounters[5] = data;         break; 
    231             case DATA_MOTHERSHAHRAZEVENT:         Encounters[6] = data;         break; 
    232             case DATA_ILLIDARICOUNCILEVENT:       Encounters[7] = data;         break; 
    233             case DATA_ILLIDANSTORMRAGEEVENT:      Encounters[8] = data;         break; 
     218        case DATA_HIGHWARLORDNAJENTUSEVENT:   Encounters[0] = data;                        break; 
     219        case DATA_SUPREMUSEVENT:              Encounters[1] = data;         break; 
     220        case DATA_SHADEOFAKAMAEVENT:          Encounters[2] = data;         break; 
     221        case DATA_TERONGOREFIENDEVENT:        Encounters[3] = data;         break; 
     222        case DATA_GURTOGGBLOODBOILEVENT:      Encounters[4] = data;         break; 
     223        case DATA_RELIQUARYOFSOULSEVENT:      Encounters[5] = data;         break; 
     224        case DATA_MOTHERSHAHRAZEVENT:         Encounters[6] = data;         break; 
     225        case DATA_ILLIDARICOUNCILEVENT:       Encounters[7] = data;         break; 
     226        case DATA_ILLIDANSTORMRAGEEVENT:      Encounters[8] = data;         break; 
    234227        } 
    235228 
    236229        if(data == DONE) 
    237                { 
     230        { 
    238231            SaveToDB(); 
    239                        BossKilled++; 
    240                } 
    241                CheckInstanceStatus(); 
    242     } 
    243  
    244        void CheckInstanceStatus() 
    245        { 
    246                if(BossKilled >= 6) 
    247                        OpenDoor(TempleDoor, true); 
    248                if(Encounters[0] == DONE) 
    249                        OpenDoor(NajentusGate, true); 
    250                if(Encounters[2] == IN_PROGRESS) 
    251                        CloseDoor(ShadeOfAkamaDoor, true); 
    252                else OpenDoor(ShadeOfAkamaDoor, true); 
    253                if(Encounters[3] == IN_PROGRESS) 
    254                { 
    255                        CloseDoor(TeronDoor, true); 
    256                        CloseDoor(CommonDoor, true); 
    257                }else{  
    258                        OpenDoor(TeronDoor, true); 
    259                        OpenDoor(CommonDoor, true); 
    260                } 
    261                if(Encounters[4] == DONE) 
    262                        OpenDoor(GuurtogDoor, true); 
    263                if(Encounters[6] == DONE) 
    264                        OpenDoor(MotherDoor, true); 
    265                if(Encounters[7] == IN_PROGRESS) 
    266                { 
    267                        CloseDoor(CouncilDoor, true); 
    268                        CloseDoor(SimpleDoor, true); 
    269                }else{ 
    270                        OpenDoor(CouncilDoor, true); 
    271                        OpenDoor(SimpleDoor, true);                      
    272                } 
    273        } 
     232            BossKilled++; 
     233        } 
     234        CheckInstanceStatus(); 
     235    } 
     236 
     237    void CheckInstanceStatus() 
     238    { 
     239        if(BossKilled >= 6) 
     240            OpenDoor(TempleDoor, true); 
     241        if(Encounters[0] == DONE) 
     242            OpenDoor(NajentusGate, true); 
     243        if(Encounters[2] == IN_PROGRESS) 
     244            CloseDoor(ShadeOfAkamaDoor, true); 
     245        else OpenDoor(ShadeOfAkamaDoor, true); 
     246        if(Encounters[3] == IN_PROGRESS) 
     247        { 
     248            CloseDoor(TeronDoor, true); 
     249            CloseDoor(CommonDoor, true); 
     250        }else{  
     251            OpenDoor(TeronDoor, true); 
     252            OpenDoor(CommonDoor, true); 
     253        } 
     254        if(Encounters[4] == DONE) 
     255            OpenDoor(GuurtogDoor, true); 
     256        if(Encounters[6] == DONE) 
     257            OpenDoor(MotherDoor, true); 
     258        if(Encounters[7] == IN_PROGRESS) 
     259        { 
     260            CloseDoor(CouncilDoor, true); 
     261            CloseDoor(SimpleDoor, true); 
     262        }else{ 
     263            OpenDoor(CouncilDoor, true); 
     264            OpenDoor(SimpleDoor, true);                      
     265        } 
     266    } 
    274267 
    275268    uint32 GetData(uint32 type) 
     
    277270        switch(type) 
    278271        { 
    279             case DATA_HIGHWARLORDNAJENTUSEVENT:         return Encounters[0]; 
    280             case DATA_SUPREMUSEVENT:                    return Encounters[1]; 
    281             case DATA_SHADEOFAKAMAEVENT:                return Encounters[2]; 
    282             case DATA_TERONGOREFIENDEVENT:              return Encounters[3]; 
    283             case DATA_GURTOGGBLOODBOILEVENT:            return Encounters[4]; 
    284             case DATA_RELIQUARYOFSOULSEVENT:            return Encounters[5]; 
    285             case DATA_MOTHERSHAHRAZEVENT:               return Encounters[6]; 
    286             case DATA_ILLIDARICOUNCILEVENT:             return Encounters[7]; 
    287             case DATA_ILLIDANSTORMRAGEEVENT:            return Encounters[8]; 
     272        case DATA_HIGHWARLORDNAJENTUSEVENT:         return Encounters[0]; 
     273        case DATA_SUPREMUSEVENT:                    return Encounters[1]; 
     274        case DATA_SHADEOFAKAMAEVENT:                return Encounters[2]; 
     275        case DATA_TERONGOREFIENDEVENT:              return Encounters[3]; 
     276        case DATA_GURTOGGBLOODBOILEVENT:            return Encounters[4]; 
     277        case DATA_RELIQUARYOFSOULSEVENT:            return Encounters[5]; 
     278        case DATA_MOTHERSHAHRAZEVENT:               return Encounters[6]; 
     279        case DATA_ILLIDARICOUNCILEVENT:             return Encounters[7]; 
     280        case DATA_ILLIDANSTORMRAGEEVENT:            return Encounters[8]; 
    288281        } 
    289282 
     
    320313        std::istringstream stream(in); 
    321314        stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] 
    322             >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] 
    323             >> Encounters[8]; 
     315        >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] 
     316        >> Encounters[8]; 
    324317        for(uint8 i = 0; i < ENCOUNTERS; ++i) 
    325318            if(Encounters[i] == IN_PROGRESS)                // Do not load an encounter as "In Progress" - reset it instead. 
  • trunk/src/game/Creature.cpp

    r174 r178  
    319319    m_spells[2] = GetCreatureInfo()->spell3; 
    320320    m_spells[3] = GetCreatureInfo()->spell4; 
     321 
     322    // HACK: trigger creature is always not selectable 
     323    if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) 
     324        SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    321325 
    322326    return true; 
     
    14881492} 
    14891493 
     1494bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const 
     1495{ 
     1496    // not in world 
     1497    if(!IsInWorld() || !u->IsInWorld()) 
     1498        return false; 
     1499 
     1500    // all dead creatures/players not visible for any creatures 
     1501    if(!u->isAlive() || !isAlive()) 
     1502        return false; 
     1503 
     1504    // Always can see self 
     1505    if (u == this) 
     1506        return true; 
     1507 
     1508    // always seen by owner 
     1509    if(GetGUID() == u->GetCharmerOrOwnerGUID()) 
     1510        return true; 
     1511 
     1512    if(u->GetVisibility() == VISIBILITY_OFF) //GM 
     1513        return false; 
     1514 
     1515    // invisible aura 
     1516    if((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u)) 
     1517        return false; 
     1518 
     1519    // unit got in stealth in this moment and must ignore old detected state 
     1520    //if (m_Visibility == VISIBILITY_GROUP_NO_DETECT) 
     1521    //    return false; 
     1522 
     1523    // GM invisibility checks early, invisibility if any detectable, so if not stealth then visible 
     1524    if(u->GetVisibility() == VISIBILITY_GROUP_STEALTH) 
     1525    { 
     1526        //do not know what is the use of this detect 
     1527        if(!detect || !canDetectStealthOf(u, GetDistance(u))) 
     1528            return false; 
     1529    } 
     1530 
     1531    // Now check is target visible with LoS 
     1532    return u->IsWithinLOS(GetPositionX(),GetPositionY(),GetPositionZ()); 
     1533} 
     1534 
    14901535float Creature::GetAttackDistance(Unit const* pl) const 
    14911536{ 
     
    16991744} 
    17001745 
    1701 bool Creature::IsVisibleInGridForPlayer(Player* pl) const 
     1746bool Creature::IsVisibleInGridForPlayer(Player const* pl) const 
    17021747{ 
    17031748    // gamemaster in GM mode see all, including ghosts 
  • trunk/src/game/Creature.h

    r174 r178  
    548548        uint32 m_GlobalCooldown; 
    549549 
     550        bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 
    550551        float GetAttackDistance(Unit const* pl) const; 
    551552 
     
    561562        void SetCurrentCell(Cell const& cell) { m_currentCell = cell; } 
    562563 
    563         bool IsVisibleInGridForPlayer(Player* pl) const; 
     564        bool IsVisibleInGridForPlayer(Player const* pl) const; 
    564565 
    565566        void RemoveCorpse(); 
  • trunk/src/game/Object.cpp

    r174 r178  
    14871487        if(GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) 
    14881488            pCreature->setFaction(((Unit*)this)->getFaction()); 
    1489         pCreature->CastSpell(pCreature, pCreature->m_spells[0], true, 0, 0, GetGUID()); 
     1489        pCreature->CastSpell(pCreature, pCreature->m_spells[0], false, 0, 0, GetGUID()); 
    14901490    } 
    14911491 
  • trunk/src/game/OutdoorPvPObjectiveAI.cpp

    r102 r178  
    5151void OutdoorPvPObjectiveAI::AttackStart(Unit *) 
    5252{ 
    53     EnterEvadeMode(); 
     53    //EnterEvadeMode(); 
    5454} 
    5555 
    5656void OutdoorPvPObjectiveAI::EnterEvadeMode() 
    5757{ 
    58     i_creature.DeleteThreatList(); 
    59     i_creature.CombatStop(); 
     58//    i_creature.DeleteThreatList(); 
     59//    i_creature.CombatStop(); 
    6060} 
    6161 
  • trunk/src/game/Player.cpp

    r177 r178  
    20012001        if(HasAuraType(SPELL_AURA_MOD_STEALTH)) 
    20022002            SetVisibility(VISIBILITY_GROUP_STEALTH); 
    2003         else if(HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) 
    2004             SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
     2003        //else if(HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) 
     2004        //    SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
    20052005        else 
    20062006            SetVisibility(VISIBILITY_ON); 
     
    1639616396        if ((*i)->isVisibleForOrDetect(this,true)) 
    1639716397        { 
    16398  
    1639916398            (*i)->SendUpdateToPlayer(this); 
    1640016399            m_clientGUIDs.insert((*i)->GetGUID()); 
     
    1718917188} 
    1719017189 
    17191 bool Player::IsVisibleInGridForPlayer( Player* pl ) const 
     17190bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const 
     17191{ 
     17192    // Always can see self 
     17193    if (u == this) 
     17194        return true; 
     17195 
     17196    // player visible for other player if not logout and at same transport 
     17197    // including case when player is out of world 
     17198    bool at_same_transport = 
     17199        GetTransport() && u->GetTypeId() == TYPEID_PLAYER 
     17200        && !GetSession()->PlayerLogout() && !((Player*)u)->GetSession()->PlayerLogout() 
     17201        && !GetSession()->PlayerLoading() && !((Player*)u)->GetSession()->PlayerLoading() 
     17202        && GetTransport() == ((Player*)u)->GetTransport(); 
     17203 
     17204    // not in world 
     17205    if(!at_same_transport && (!IsInWorld() || !u->IsInWorld())) 
     17206        return false; 
     17207 
     17208    // forbidden to seen (at GM respawn command) 
     17209    if(u->GetVisibility() == VISIBILITY_RESPAWN) 
     17210        return false; 
     17211 
     17212    // always seen by owner 
     17213    if(GetGUID() == u->GetCharmerOrOwnerGUID()) 
     17214        return true; 
     17215 
     17216    // Grid dead/alive checks 
     17217    // non visible at grid for any stealth state 
     17218    if(!u->IsVisibleInGridForPlayer(this)) 
     17219        return false; 
     17220 
     17221    // If the player is currently possessing, update visibility from the possessed unit's location 
     17222    const Unit* target = isPossessing() ? GetCharm() : this; 
     17223 
     17224    // different visible distance checks 
     17225    if(isInFlight())                                     // what see player in flight 
     17226    { 
     17227        if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))) 
     17228            return false; 
     17229    } 
     17230    else if(!u->isAlive())                                     // distance for show body 
     17231    { 
     17232        if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))) 
     17233            return false; 
     17234    } 
     17235    else if(u->GetTypeId()==TYPEID_PLAYER)                     // distance for show player 
     17236    { 
     17237        // Players far than max visible distance for player or not in our map are not visible too 
     17238        if (!at_same_transport && !target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) 
     17239            return false; 
     17240    } 
     17241    else if(u->GetCharmerOrOwnerGUID())                        // distance for show pet/charmed 
     17242    { 
     17243        // Pet/charmed far than max visible distance for player or not in our map are not visible too 
     17244        if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) 
     17245            return false; 
     17246    } 
     17247    else                                                    // distance for show creature 
     17248    { 
     17249        // Units far than max visible distance for creature or not in our map are not visible too 
     17250        if (!target->IsWithinDistInMap(u, target->isActive()  
     17251                ? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance())) 
     17252                : (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))) 
     17253            return false; 
     17254    } 
     17255 
     17256    // GMs see any players, not higher GMs and all units 
     17257    if(isGameMaster()) 
     17258    { 
     17259        if(u->GetTypeId() == TYPEID_PLAYER) 
     17260            return ((Player *)u)->GetSession()->GetSecurity() <= GetSession()->GetSecurity(); 
     17261        else 
     17262            return true; 
     17263    } 
     17264 
     17265    if(u->GetVisibility() == VISIBILITY_OFF) 
     17266        return false; 
     17267 
     17268    // player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting) 
     17269    if((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u)) 
     17270        if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u)))) 
     17271            return false; 
     17272 
     17273    // GM invisibility checks early, invisibility if any detectable, so if not stealth then visible 
     17274    if(u->GetVisibility() == VISIBILITY_GROUP_STEALTH) 
     17275    { 
     17276        // if player is dead then he can't detect anyone in anycases 
     17277        //do not know what is the use of this detect 
     17278        // stealth and detected and visible for some seconds 
     17279        if(!isAlive()) 
     17280            detect = false; 
     17281        if(m_DetectInvTimer < 300 || !HaveAtClient(u)) 
     17282            if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u)))) 
     17283                if(!detect || !canDetectStealthOf(u, GetDistance(u))) 
     17284                    return false; 
     17285    } 
     17286 
     17287    // Now check is target visible with LoS 
     17288    return u->IsWithinLOS(GetPositionX(),GetPositionY(),GetPositionZ()); 
     17289} 
     17290 
     17291bool Player::IsVisibleInGridForPlayer( Player const * pl ) const 
    1719217292{ 
    1719317293    // gamemaster in GM mode see all, including ghosts 
  • trunk/src/game/Player.h

    r177 r178  
    19931993        ClientGUIDs m_clientGUIDs; 
    19941994 
    1995         bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); } 
    1996  
    1997         bool IsVisibleInGridForPlayer(Player* pl) const; 
     1995        bool HaveAtClient(WorldObject const* u) const { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); } 
     1996 
     1997        bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 
     1998        bool IsVisibleInGridForPlayer(Player const* pl) const; 
    19981999        bool IsVisibleGloballyFor(Player* pl) const; 
    19992000 
  • trunk/src/game/SpellAuras.cpp

    r174 r178  
    32313231            if(m_target->GetVisibility()!=VISIBILITY_OFF) 
    32323232            { 
    3233                 m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
     3233                //m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
     3234                m_target->SetVisibility(VISIBILITY_OFF); 
    32343235                m_target->SetVisibility(VISIBILITY_GROUP_STEALTH); 
    32353236            } 
     
    32593260                if(m_target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) 
    32603261                { 
    3261                     m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
    3262                     m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
     3262                    //m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
     3263                    //m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
     3264                    m_target->SetVisibility(VISIBILITY_ON); 
    32633265                } 
    32643266                else 
     
    33153317        { 
    33163318            // Aura not added yet but visibility code expect temporary add aura 
    3317             m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
    3318             m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
     3319            //m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 
     3320            //m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); 
     3321            m_target->SetVisibility(VISIBILITY_ON); 
    33193322        } 
    33203323    } 
  • trunk/src/game/SpellEffects.cpp

    r174 r178  
    35773577    } 
    35783578 
     3579    // trigger 
     3580    if(m_spellInfo->Id == 40276) 
     3581    { 
     3582        EffectSummonWild(i); 
     3583        return; 
     3584    } 
     3585 
    35793586    // set timer for unsummon 
    35803587    int32 duration = GetSpellDuration(m_spellInfo); 
  • trunk/src/game/Unit.cpp

    r174 r178  
    85078507        return false; 
    85088508 
    8509     if(GetTypeId()==TYPEID_UNIT && (((Creature *)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)) 
    8510         return false; 
    8511  
    85128509    return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; 
    85138510} 
     
    85818578    if(!u) 
    85828579        return false; 
    8583  
    8584     // Always can see self 
    8585     if (u==this) 
     8580    return u->canSeeOrDetect(this, detect, inVisibleList); 
     8581} 
     8582 
     8583bool Unit::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const 
     8584{ 
     8585    return true; 
     8586} 
     8587 
     8588bool Unit::canDetectInvisibilityOf(Unit const* u) const 
     8589{ 
     8590    if(m_invisibilityMask & u->m_invisibilityMask) // same group 
    85868591        return true; 
    8587  
    8588     // player visible for other player if not logout and at same transport 
    8589     // including case when player is out of world 
    8590     bool at_same_transport = 
    8591         GetTypeId() == TYPEID_PLAYER &&  u->GetTypeId()==TYPEID_PLAYER && 
    8592         !((Player*)this)->GetSession()->PlayerLogout() && !((Player*)u)->GetSession()->PlayerLogout() && 
    8593         !((Player*)this)->GetSession()->PlayerLoading() && !((Player*)u)->GetSession()->PlayerLoading() && 
    8594         ((Player*)this)->GetTransport() && ((Player*)this)->GetTransport() == ((Player*)u)->GetTransport(); 
    8595  
    8596     // not in world 
    8597     if(!at_same_transport && (!IsInWorld() || !u->IsInWorld())) 
    8598         return false; 
    8599  
    8600     // forbidden to seen (at GM respawn command) 
    8601     if(m_Visibility==VISIBILITY_RESPAWN) 
    8602         return false; 
    8603  
    8604     // always seen by owner 
    8605     if(GetCharmerOrOwnerGUID()==u->GetGUID()) 
    8606         return true; 
    8607  
    8608     // Grid dead/alive checks 
    8609     if( u->GetTypeId()==TYPEID_PLAYER) 
    8610     { 
    8611         // non visible at grid for any stealth state 
    8612         if(!IsVisibleInGridForPlayer((Player *)u)) 
    8613             return false; 
    8614  
    8615         // if player is dead then he can't detect anyone in anycases 
    8616         if(!u->isAlive()) 
    8617             detect = false; 
    8618     } 
    8619     else 
    8620     { 
    8621         // all dead creatures/players not visible for any creatures 
    8622         if(!u->isAlive() || !isAlive()) 
    8623             return false; 
    8624     } 
    8625  
    8626     // If the player is currently possessing, update visibility from the possessed unit's location 
    8627     const Unit* target = u->GetTypeId() == TYPEID_PLAYER && u->isPossessing() ? u->GetCharm() : u; 
    8628  
    8629     // different visible distance checks 
    8630     if(u->isInFlight())                                     // what see player in flight 
    8631     { 
    8632         // use object grey distance for all (only see objects any way) 
    8633         if (!IsWithinDistInMap(target,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))) 
    8634             return false; 
    8635     } 
    8636     else if(!isAlive())                                     // distance for show body 
    8637     { 
    8638         if (!IsWithinDistInMap(target,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))) 
    8639             return false; 
    8640     } 
    8641     else if(GetTypeId()==TYPEID_PLAYER)                     // distance for show player 
    8642     { 
    8643         if(u->GetTypeId()==TYPEID_PLAYER) 
    8644         { 
    8645             // Players far than max visible distance for player or not in our map are not visible too 
    8646             if (!at_same_transport && !IsWithinDistInMap(target,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) 
    8647                 return false; 
    8648         } 
    8649         else 
    8650         { 
    8651             // Units far than max visible distance for creature or not in our map are not visible too 
    8652             // Active unit should always be visibile 
    8653             if (!IsWithinDistInMap(target, target->isActive()  
    8654                 ? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance())) 
    8655                 : (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))) 
    8656                 return false; 
    8657         } 
    8658     } 
    8659     else if(GetCharmerOrOwnerGUID())                        // distance for show pet/charmed 
    8660     { 
    8661         // Pet/charmed far than max visible distance for player or not in our map are not visible too 
    8662         if (!IsWithinDistInMap(target,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) 
    8663             return false; 
    8664     } 
    8665     else                                                    // distance for show creature 
    8666     { 
    8667         // Units far than max visible distance for creature or not in our map are not visible too 
    8668         if (!IsWithinDistInMap(target,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) 
    8669             return false; 
    8670     } 
    8671  
    8672     // Visible units, always are visible for all units, except for units under invisibility 
    8673     if (m_Visibility == VISIBILITY_ON && u->m_invisibilityMask==0) 
    8674         return true; 
    8675  
    8676     // GMs see any players, not higher GMs and all units 
    8677     if (u->GetTypeId() == TYPEID_PLAYER && ((Player *)u)->isGameMaster()) 
    8678     { 
    8679         if(GetTypeId() == TYPEID_PLAYER) 
    8680             return ((Player *)this)->GetSession()->GetSecurity() <= ((Player *)u)->GetSession()->GetSecurity(); 
    8681         else 
     8592    AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark 
     8593    for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) 
     8594        if((*iter)->GetCasterGUID()==u->GetGUID()) 
    86828595            return true; 
    8683     } 
    8684  
    8685     // non faction visibility non-breakable for non-GMs 
    8686     if (m_Visibility == VISIBILITY_OFF) 
    8687         return false; 
    8688  
    8689     // raw invisibility 
    8690     bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0); 
    8691  
    8692     // detectable invisibility case 
    8693     if( invisible && ( 
    8694         // Invisible units, always are visible for units under same invisibility type 
    8695         (m_invisibilityMask & u->m_invisibilityMask)!=0 || 
    8696         // Invisible units, always are visible for unit that can detect this invisibility (have appropriate level for detect) 
    8697         u->canDetectInvisibilityOf(this) || 
    8698         // Units that can detect invisibility always are visible for units that can be detected 
    8699         canDetectInvisibilityOf(u) )) 
    8700     { 
    8701         invisible = false; 
    8702     } 
    8703  
    8704     // special cases for always overwrite invisibility/stealth 
    8705     if(invisible || m_Visibility == VISIBILITY_GROUP_STEALTH) 
    8706     { 
    8707         // non-hostile case 
    8708         if (!u->IsHostileTo(this)) 
    8709         { 
    8710             // player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting) 
    8711             if(GetTypeId()==TYPEID_PLAYER && u->GetTypeId()==TYPEID_PLAYER) 
    8712             { 
    8713                 if(((Player*)this)->IsGroupVisibleFor(((Player*)u))) 
    8714                     return true; 
    8715  
    8716                 // else apply same rules as for hostile case (detecting check for stealth) 
    8717             } 
    8718         } 
    8719         // hostile case 
    8720         else 
    8721         { 
    8722             // Hunter mark functionality 
    8723             AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_STALKED); 
    8724             for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) 
    8725                 if((*iter)->GetCasterGUID()==u->GetGUID()) 
    8726                     return true; 
    8727  
    8728             // else apply detecting check for stealth 
    8729         } 
    8730  
    8731         // none other cases for detect invisibility, so invisible 
    8732         if(invisible) 
    8733             return false; 
    8734  
    8735         // else apply stealth detecting check 
    8736     } 
    8737  
    8738     // unit got in stealth in this moment and must ignore old detected state 
    8739     if (m_Visibility == VISIBILITY_GROUP_NO_DETECT) 
    8740         return false; 
    8741  
    8742     // GM invisibility checks early, invisibility if any detectable, so if not stealth then visible 
    8743     if (m_Visibility != VISIBILITY_GROUP_STEALTH) 
    8744         return true; 
    8745  
    8746     // NOW ONLY STEALTH CASE 
    8747  
    8748     // stealth and detected and visible for some seconds 
    8749     if (u->GetTypeId() == TYPEID_PLAYER  && ((Player*)u)->m_DetectInvTimer > 300 && ((Player*)u)->HaveAtClient(this)) 
    8750         return true; 
    8751  
    8752     //if in non-detect mode then invisible for unit 
    8753     if (!detect) 
    8754         return false; 
    8755  
    8756     // Special cases 
    8757  
    8758     // If is attacked then stealth is lost, some creature can use stealth too 
    8759     if( !getAttackers().empty() ) 
    8760         return true; 
    8761  
    8762     // If there is collision rogue is seen regardless of level difference 
    8763     // TODO: check sizes in DB 
    8764     float distance = GetDistance(u); 
    8765     if (distance < 0.24f) 
    8766         return true; 
    8767  
    8768     //If a mob or player is stunned he will not be able to detect stealth 
    8769     if (u->hasUnitState(UNIT_STAT_STUNNED) && (u != this)) 
    8770         return false; 
    8771  
    8772     // Creature can detect target only in aggro radius 
    8773     if(u->GetTypeId() != TYPEID_PLAYER) 
    8774     { 
    8775         //Always invisible from back and out of aggro range 
    8776         bool isInFront = u->isInFront(this,((Creature const*)u)->GetAttackDistance(this)); 
    8777         if(!isInFront) 
    8778             return false; 
    8779     } 
    8780     else 
    8781     { 
    8782         //Always invisible from back 
    8783         bool isInFront = u->isInFront(this,(GetTypeId()==TYPEID_PLAYER || GetCharmerOrOwnerGUID()) ? World::GetMaxVisibleDistanceForPlayer() : World::GetMaxVisibleDistanceForCreature()); 
    8784         if(!isInFront) 
    8785             return false; 
    8786     } 
    8787  
    8788     // if doesn't have stealth detection (Shadow Sight), then check how stealthy the unit is, otherwise just check los 
    8789     if(!u->HasAuraType(SPELL_AURA_DETECT_STEALTH)) 
    8790     { 
    8791         //Calculation if target is in front 
    8792  
    8793         //Visible distance based on stealth value (stealth rank 4 300MOD, 10.5 - 3 = 7.5) 
    8794         float visibleDistance = 10.5f - (GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH)/100.0f); 
    8795  
    8796         //Visible distance is modified by 
    8797         //-Level Diff (every level diff = 1.0f in visible distance) 
    8798         visibleDistance += int32(u->getLevelForTarget(this)) - int32(this->getLevelForTarget(u)); 
    8799  
    8800         //This allows to check talent tree and will add addition stealth dependent on used points) 
    8801         int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL); 
    8802         if(stealthMod < 0) 
    8803             stealthMod = 0; 
    8804  
    8805         //-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia) 
    8806         //based on wowwiki every 5 mod we have 1 more level diff in calculation 
    8807         visibleDistance += (int32(u->GetTotalAuraModifier(SPELL_AURA_MOD_DETECT)) - stealthMod)/5.0f; 
    8808  
    8809         if(distance > visibleDistance) 
    8810             return false; 
    8811     } 
    8812  
    8813     // Now check is target visible with LoS 
    8814     float ox,oy,oz; 
    8815     u->GetPosition(ox,oy,oz); 
    8816     return IsWithinLOS(ox,oy,oz); 
    8817 } 
    8818  
    8819 void Unit::SetVisibility(UnitVisibility x) 
    8820 { 
    8821     m_Visibility = x; 
    8822  
    8823     if(IsInWorld()) 
    8824     { 
    8825         Map *m = MapManager::Instance().GetMap(GetMapId(), this); 
    8826  
    8827         if(GetTypeId()==TYPEID_PLAYER) 
    8828             m->PlayerRelocation((Player*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation()); 
    8829         else 
    8830             m->CreatureRelocation((Creature*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation()); 
    8831     } 
    8832 } 
    8833  
    8834 bool Unit::canDetectInvisibilityOf(Unit const* u) const 
    8835 { 
     8596 
    88368597    if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask)) 
    88378598    { 
     
    88508611            // find invisibility detect level 
    88518612            uint32 detectLevel = 0; 
    8852             Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); 
    8853             for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr) 
    8854                 if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount) 
    8855                     detectLevel = (*itr)->GetModifier()->m_amount; 
    8856  
    88578613            if(i==6 && GetTypeId()==TYPEID_PLAYER)          // special drunk detection case 
    88588614            { 
    88598615                detectLevel = ((Player*)this)->GetDrunkValue(); 
     8616            } 
     8617            else 
     8618            { 
     8619                Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); 
     8620                for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr) 
     8621                    if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount) 
     8622                        detectLevel = (*itr)->GetModifier()->m_amount; 
    88608623            } 
    88618624 
     
    88668629 
    88678630    return false; 
     8631} 
     8632 
     8633bool Unit::canDetectStealthOf(Unit const* target, float distance) const 
     8634{ 
     8635    if(hasUnitState(UNIT_STAT_STUNNED)) 
     8636        return false; 
     8637    if(distance < 0.24f) //collision 
     8638        return true; 
     8639    if(!HasInArc(M_PI, target)) //behind 
     8640        return false; 
     8641    if(HasAuraType(SPELL_AURA_DETECT_STEALTH)) 
     8642        return true; 
     8643 
     8644    //Visible distance based on stealth value (stealth rank 4 300MOD, 10.5 - 3 = 7.5) 
     8645    float visibleDistance = 10.5f - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH) / 100.0f; 
     8646    //Visible distance is modified by -Level Diff (every level diff = 1.0f in visible distance) 
     8647    visibleDistance += int32(getLevelForTarget(target)) - int32(target->getLevelForTarget(this)); 
     8648    //-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia) 
     8649    //based on wowwiki every 5 mod we have 1 more level diff in calculation 
     8650    visibleDistance += (float)(GetTotalAuraModifier(SPELL_AURA_MOD_DETECT) - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL)) / 5.0f; 
     8651 
     8652    return distance < visibleDistance; 
     8653} 
     8654 
     8655void Unit::SetVisibility(UnitVisibility x) 
     8656{ 
     8657    m_Visibility = x; 
     8658 
     8659    if(IsInWorld()) 
     8660    { 
     8661        Map *m = MapManager::Instance().GetMap(GetMapId(), this); 
     8662 
     8663        if(GetTypeId()==TYPEID_PLAYER) 
     8664            m->PlayerRelocation((Player*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation()); 
     8665        else 
     8666            m->CreatureRelocation((Creature*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation()); 
     8667    } 
    88688668} 
    88698669 
  • trunk/src/game/Unit.h

    r174 r178  
    438438    VISIBILITY_ON                 = 1, 
    439439    VISIBILITY_GROUP_STEALTH      = 2,                      // detect chance, seen and can see group members 
    440     VISIBILITY_GROUP_INVISIBILITY = 3,                      // invisibility, can see and can be seen only another invisible unit or invisible detection unit, set only if not stealthed, and in checks not used (mask used instead) 
    441     VISIBILITY_GROUP_NO_DETECT    = 4,                      // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break 
     440    //VISIBILITY_GROUP_INVISIBILITY = 3,                      // invisibility, can see and can be seen only another invisible unit or invisible detection unit, set only if not stealthed, and in checks not used (mask used instead) 
     441    //VISIBILITY_GROUP_NO_DETECT    = 4,                      // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break 
    442442    VISIBILITY_RESPAWN            = 5                       // special totally not detectable visibility for force delete object at respawn command 
    443443}; 
     
    11361136 
    11371137        // common function for visibility checks for player/creatures with detection code 
     1138        virtual bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 
    11381139        bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false) const; 
    11391140        bool canDetectInvisibilityOf(Unit const* u) const; 
     1141        bool canDetectStealthOf(Unit const* u, float distance) const; 
    11401142 
    11411143        // virtual functions for all world objects types 
    11421144        bool isVisibleForInState(Player const* u, bool inVisibleList) const; 
    11431145        // function for low level grid visibility checks in player/creature cases 
    1144         virtual bool IsVisibleInGridForPlayer(Player* pl) const = 0; 
     1146        virtual bool IsVisibleInGridForPlayer(Player const* pl) const = 0; 
    11451147 
    11461148        bool waterbreath; 
  • trunk/src/trinityrealm/AuthCodes.h

    r102 r178  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/trinityrealm/AuthSocket.h

    r170 r178  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    7676        std::string _login; 
    7777        std::string _safelogin; 
    78          
    79          
     78 
    8079        // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ 
    8180        // between enUS and enGB, which is important for the patch system 
  • trunk/src/trinityrealm/Main.cpp

    r102 r178  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    341341    signal(SIGBREAK, 0); 
    342342    #endif 
    343  
    344343} 
    345344 
  • trunk/src/trinityrealm/RealmList.cpp

    r102 r178  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020