Changeset 178
- Timestamp:
- 11/19/08 13:43:40 (17 years ago)
- 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 3 1 DROP TABLE IF EXISTS `spell_linked_spell`; 4 2 CREATE 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 );1 DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, 41126, 41376); 2 2 -- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39992, 39835, 1, 'Needle Spine'); 3 3 INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39835, 39968, 1, 'Needle Spine'); 4 INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41376, 41377, 0, 'Spite'); 4 5 INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend'); 5 6 INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (41126, 41131, 1, 'Flame Crash'); 6 7 8 -- molten_flame 7 9 UPDATE creature_template SET flags_extra = 128, speed = 1.0 WHERE entry = 23095; 10 -- volcano 11 UPDATE creature_template SET spell1 = 40117, flags_extra = 128, scriptname = '' WHERE entry = 23085; 12 -- flame crash 13 update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336; 14 -- blaze 15 update 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 1 1 /* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 2 3 4 5 6 7 8 9 10 11 12 13 14 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 */ 16 16 17 17 /* ScriptData … … 383 383 uint64 GlaiveGUID[2]; 384 384 385 std::list<uint64> ParasiteTargets; // for safety, do not use Unit*386 387 385 void Reset(); 388 386 … … 434 432 void Aggro(Unit *who) 435 433 { 434 m_creature->setActive(true); 436 435 DoZoneInCombat(); 437 436 } … … 502 501 m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); 503 502 } 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;517 503 } 518 504 … … 563 549 case 1://lift off 564 550 m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); 565 //m_creature->GetMotionMaster()->Clear(false);566 551 m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); 567 //m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ());568 552 m_creature->StopMoving(); 569 553 DoYell(SAY_TAKEOFF, LANG_UNIVERSAL, NULL); … … 572 556 break; 573 557 case 2://move to center 574 //m_creature->GetMotionMaster()->Clear(false);575 //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);576 558 m_creature->GetMotionMaster()->MovePoint(0, CENTER_X + 5, CENTER_Y, CENTER_Z); //+5, for SPELL_THROW_GLAIVE bug 577 //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);578 559 Timer[EVENT_FLIGHT_SEQUENCE] = 0; 579 560 break; … … 615 596 break; 616 597 case 6://fly to hover point 617 //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);618 598 m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 619 //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);620 599 Timer[EVENT_FLIGHT_SEQUENCE] = 0; 621 600 break; 622 601 case 7://return to center 623 //m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);624 602 m_creature->GetMotionMaster()->MovePoint(0, CENTER_X, CENTER_Y, CENTER_Z); 625 //m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);626 603 Timer[EVENT_FLIGHT_SEQUENCE] = 0; 627 604 break; … … 642 619 break; 643 620 case 9://land 644 //m_creature->GetMotionMaster()->Clear(false);645 621 m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); 646 //m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ());647 622 m_creature->StopMoving(); 648 623 m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); … … 664 639 DoResetThreat(); 665 640 m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 666 //m_creature->GetMotionMaster()->Clear();667 641 m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); 668 642 EnterPhase(PHASE_NORMAL_2); … … 724 698 void UpdateAI(const uint32 diff) 725 699 { 726 if((!m_creature->SelectHostilTarget() ||!m_creature->getVictim()) && Phase < PHASE_TALK_SEQUENCE)700 if((!m_creature->SelectHostilTarget() && !m_creature->getVictim()) && Phase < PHASE_TALK_SEQUENCE) 727 701 return; 728 702 729 703 Event = EVENT_NULL; 730 704 for(uint32 i = 1; i <= MaxTimer[Phase]; i++) 705 { 731 706 if(Timer[i]) 732 707 if(Timer[i] <= diff) … … 736 711 } 737 712 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: 740 764 { 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); 770 772 } 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: 776 787 { 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; 870 852 } 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 } 939 890 } 940 891 }; 941 892 942 893 /********************************** 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) const951 {952 return (MainTarget->GetDistance(_Left) > MainTarget->GetDistance(_Right));953 }954 };955 894 956 895 struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI … … 973 912 void ChargeCheck() 974 913 { 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); 998 915 if(target && (!m_creature->IsWithinDistInMap(target, FLAME_CHARGE_DISTANCE))) 999 916 { … … 1129 1046 m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has strange values.. 1130 1047 m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); 1048 m_creature->setActive(false); 1131 1049 } 1132 1050 … … 1185 1103 void BeginChannel() 1186 1104 { 1105 m_creature->setActive(true); 1106 1187 1107 float x, y, z; 1188 1108 if(GETGO(Gate, GateGUID)) … … 1528 1448 m_creature->InterruptNonMeleeSpells(false); 1529 1449 m_creature->GetMotionMaster()->Clear(false); 1530 //m_creature->GetMotionMaster()->MoveIdle();1531 1450 m_creature->AttackStop(); 1532 1451 m_creature->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); … … 1558 1477 m_creature->InterruptNonMeleeSpells(false); 1559 1478 m_creature->GetMotionMaster()->Clear(false); 1560 //m_creature->GetMotionMaster()->MoveIdle();1561 1479 m_creature->Relocate(x, y, z); 1562 1480 m_creature->SendMonsterMove(x, y, z, 0, 0, 0); … … 1840 1758 if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)) 1841 1759 { 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 1845 1761 } 1846 1762 m_creature->AttackerStateUpdate(m_creature->getVictim()); … … 1937 1853 }; 1938 1854 1939 struct TRINITY_DLL_DECL blazeAI : public ScriptedAI1940 {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 min1950 //((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 60s1963 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 ScriptedAI1975 {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 inf1983 DespawnTimer = 120000; // summon spell duration1984 }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 2000 1855 struct TRINITY_DLL_DECL blade_of_azzinothAI : public ScriptedAI 2001 1856 { … … 2070 1925 FlightCount = 0; 2071 1926 TransformCount = 0; 2072 2073 ParasiteTargets.clear();2074 1927 2075 1928 m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135); … … 2081 1934 2082 1935 m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); 1936 m_creature->setActive(false); 2083 1937 } 2084 1938 … … 2378 2232 } 2379 2233 2380 CreatureAI* GetAI_flamecrash(Creature *_Creature)2381 {2382 return new flamecrashAI (_Creature);2383 }2384 2385 2234 CreatureAI* GetAI_demonfire(Creature *_Creature) 2386 2235 { 2387 2236 return new demonfireAI (_Creature); 2388 }2389 2390 CreatureAI* GetAI_blaze(Creature *_Creature)2391 {2392 return new blazeAI (_Creature);2393 2237 } 2394 2238 … … 2450 2294 2451 2295 newscript = new Script; 2452 newscript->Name="mob_flame_crash";2453 newscript->GetAI = GetAI_flamecrash;2454 m_scripts[nrscripts++] = newscript;2455 2456 newscript = new Script;2457 2296 newscript->Name="mob_demon_fire"; 2458 2297 newscript->GetAI = GetAI_demonfire; 2459 m_scripts[nrscripts++] = newscript;2460 2461 newscript = new Script;2462 newscript->Name="mob_blaze";2463 newscript->GetAI = GetAI_blaze;2464 2298 m_scripts[nrscripts++] = newscript; 2465 2299 -
trunk/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
r90 r178 635 635 } 636 636 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 true672 for(itr = tempUnitMap.begin(); itr != tempUnitMap.end(); ++itr)673 (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);674 }675 676 637 void UpdateAI(const uint32 diff) 677 638 { … … 701 662 { 702 663 DoCast(m_creature->getVictim(), SPELL_SOUL_SCREAM); 703 SoulScreamTimer = 10000;664 SoulScreamTimer = 9000 + rand()%2000; 704 665 if(!(rand()%3)) 705 666 { … … 711 672 if(SpiteTimer < diff) 712 673 { 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); 733 678 }else SpiteTimer -= diff; 734 679 -
trunk/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp
r90 r178 1 1 /* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 2 3 4 5 6 7 8 9 10 11 12 13 14 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 */ 16 16 17 17 /* ScriptData … … 56 56 uint64 IllidanStormrage; 57 57 58 58 uint16 BossKilled; 59 59 60 60 uint64 NajentusGate; 61 61 uint64 MainTempleDoors; 62 63 64 65 66 67 68 69 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 70 70 uint64 IllidanGate; 71 71 uint64 IllidanDoor[2]; 72 73 72 74 73 uint32 Encounters[ENCOUNTERS]; … … 89 88 IllidanStormrage = 0; 90 89 91 90 BossKilled = 0; 92 91 93 92 NajentusGate = 0; 94 93 MainTempleDoors = 0; 95 96 97 98 99 100 101 102 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; 103 102 IllidanGate = 0; 104 103 IllidanDoor[0] = 0; … … 119 118 void OpenDoor(uint64 DoorGUID, bool open) 120 119 { 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 } 136 129 137 130 void OnCreatureCreate(Creature *creature, uint32 creature_entry) … … 139 132 switch(creature_entry) 140 133 { 141 142 143 144 145 146 147 148 149 150 151 152 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; 153 146 } 154 147 } … … 158 151 switch(go->GetEntry()) 159 152 { 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 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; 192 185 } 193 186 } … … 197 190 switch(identifier) 198 191 { 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 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; 216 209 } 217 210 … … 223 216 switch(type) 224 217 { 225 226 227 228 229 230 231 232 233 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; 234 227 } 235 228 236 229 if(data == DONE) 237 230 { 238 231 SaveToDB(); 239 240 241 242 } 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 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 } 274 267 275 268 uint32 GetData(uint32 type) … … 277 270 switch(type) 278 271 { 279 280 281 282 283 284 285 286 287 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]; 288 281 } 289 282 … … 320 313 std::istringstream stream(in); 321 314 stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] 322 323 315 >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] 316 >> Encounters[8]; 324 317 for(uint8 i = 0; i < ENCOUNTERS; ++i) 325 318 if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. -
trunk/src/game/Creature.cpp
r174 r178 319 319 m_spells[2] = GetCreatureInfo()->spell3; 320 320 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); 321 325 322 326 return true; … … 1488 1492 } 1489 1493 1494 bool 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 1490 1535 float Creature::GetAttackDistance(Unit const* pl) const 1491 1536 { … … 1699 1744 } 1700 1745 1701 bool Creature::IsVisibleInGridForPlayer(Player * pl) const1746 bool Creature::IsVisibleInGridForPlayer(Player const* pl) const 1702 1747 { 1703 1748 // gamemaster in GM mode see all, including ghosts -
trunk/src/game/Creature.h
r174 r178 548 548 uint32 m_GlobalCooldown; 549 549 550 bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 550 551 float GetAttackDistance(Unit const* pl) const; 551 552 … … 561 562 void SetCurrentCell(Cell const& cell) { m_currentCell = cell; } 562 563 563 bool IsVisibleInGridForPlayer(Player * pl) const;564 bool IsVisibleInGridForPlayer(Player const* pl) const; 564 565 565 566 void RemoveCorpse(); -
trunk/src/game/Object.cpp
r174 r178 1487 1487 if(GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) 1488 1488 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()); 1490 1490 } 1491 1491 -
trunk/src/game/OutdoorPvPObjectiveAI.cpp
r102 r178 51 51 void OutdoorPvPObjectiveAI::AttackStart(Unit *) 52 52 { 53 EnterEvadeMode();53 //EnterEvadeMode(); 54 54 } 55 55 56 56 void OutdoorPvPObjectiveAI::EnterEvadeMode() 57 57 { 58 i_creature.DeleteThreatList();59 i_creature.CombatStop();58 // i_creature.DeleteThreatList(); 59 // i_creature.CombatStop(); 60 60 } 61 61 -
trunk/src/game/Player.cpp
r177 r178 2001 2001 if(HasAuraType(SPELL_AURA_MOD_STEALTH)) 2002 2002 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); 2005 2005 else 2006 2006 SetVisibility(VISIBILITY_ON); … … 16396 16396 if ((*i)->isVisibleForOrDetect(this,true)) 16397 16397 { 16398 16399 16398 (*i)->SendUpdateToPlayer(this); 16400 16399 m_clientGUIDs.insert((*i)->GetGUID()); … … 17189 17188 } 17190 17189 17191 bool Player::IsVisibleInGridForPlayer( Player* pl ) const 17190 bool 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 17291 bool Player::IsVisibleInGridForPlayer( Player const * pl ) const 17192 17292 { 17193 17293 // gamemaster in GM mode see all, including ghosts -
trunk/src/game/Player.h
r177 r178 1993 1993 ClientGUIDs m_clientGUIDs; 1994 1994 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; 1998 1999 bool IsVisibleGloballyFor(Player* pl) const; 1999 2000 -
trunk/src/game/SpellAuras.cpp
r174 r178 3231 3231 if(m_target->GetVisibility()!=VISIBILITY_OFF) 3232 3232 { 3233 m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 3233 //m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); 3234 m_target->SetVisibility(VISIBILITY_OFF); 3234 3235 m_target->SetVisibility(VISIBILITY_GROUP_STEALTH); 3235 3236 } … … 3259 3260 if(m_target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) 3260 3261 { 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); 3263 3265 } 3264 3266 else … … 3315 3317 { 3316 3318 // 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); 3319 3322 } 3320 3323 } -
trunk/src/game/SpellEffects.cpp
r174 r178 3577 3577 } 3578 3578 3579 // trigger 3580 if(m_spellInfo->Id == 40276) 3581 { 3582 EffectSummonWild(i); 3583 return; 3584 } 3585 3579 3586 // set timer for unsummon 3580 3587 int32 duration = GetSpellDuration(m_spellInfo); -
trunk/src/game/Unit.cpp
r174 r178 8507 8507 return false; 8508 8508 8509 if(GetTypeId()==TYPEID_UNIT && (((Creature *)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))8510 return false;8511 8512 8509 return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; 8513 8510 } … … 8581 8578 if(!u) 8582 8579 return false; 8583 8584 // Always can see self 8585 if (u==this) 8580 return u->canSeeOrDetect(this, detect, inVisibleList); 8581 } 8582 8583 bool Unit::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const 8584 { 8585 return true; 8586 } 8587 8588 bool Unit::canDetectInvisibilityOf(Unit const* u) const 8589 { 8590 if(m_invisibilityMask & u->m_invisibilityMask) // same group 8586 8591 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()) 8682 8595 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 8836 8597 if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask)) 8837 8598 { … … 8850 8611 // find invisibility detect level 8851 8612 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 8857 8613 if(i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case 8858 8614 { 8859 8615 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; 8860 8623 } 8861 8624 … … 8866 8629 8867 8630 return false; 8631 } 8632 8633 bool 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 8655 void 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 } 8868 8668 } 8869 8669 -
trunk/src/game/Unit.h
r174 r178 438 438 VISIBILITY_ON = 1, 439 439 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 break440 //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 442 442 VISIBILITY_RESPAWN = 5 // special totally not detectable visibility for force delete object at respawn command 443 443 }; … … 1136 1136 1137 1137 // common function for visibility checks for player/creatures with detection code 1138 virtual bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 1138 1139 bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false) const; 1139 1140 bool canDetectInvisibilityOf(Unit const* u) const; 1141 bool canDetectStealthOf(Unit const* u, float distance) const; 1140 1142 1141 1143 // virtual functions for all world objects types 1142 1144 bool isVisibleForInState(Player const* u, bool inVisibleList) const; 1143 1145 // 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; 1145 1147 1146 1148 bool waterbreath; -
trunk/src/trinityrealm/AuthCodes.h
r102 r178 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 -
trunk/src/trinityrealm/AuthSocket.h
r170 r178 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 76 76 std::string _login; 77 77 std::string _safelogin; 78 79 78 80 79 // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ 81 80 // between enUS and enGB, which is important for the patch system -
trunk/src/trinityrealm/Main.cpp
r102 r178 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 341 341 signal(SIGBREAK, 0); 342 342 #endif 343 344 343 } 345 344 -
trunk/src/trinityrealm/RealmList.cpp
r102 r178 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20