Changeset 284
- Timestamp:
- 11/22/08 01:55:20 (17 years ago)
- Location:
- trunk/src
- Files:
-
- 13 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/scripts/npc/npcs_special.cpp
r283 r284 826 826 } 827 827 828 struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI 829 { 830 npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {Reset();} 831 832 void Reset() {} 833 void Aggro(Unit *who) {} 834 835 void OnPossess(bool apply) 836 { 837 if (apply) 838 { 839 // Initialize the action bar without the melee attack command 840 m_creature->InitCharmInfo(m_creature); 841 m_creature->GetCharmInfo()->InitEmptyActionBar(false); 842 843 m_creature->SetAggressive(false); 844 } 845 else 846 m_creature->SetAggressive(true); 847 } 848 849 }; 850 851 CreatureAI* GetAI_npc_steam_tonk(Creature *_Creature) 852 { 853 return new npc_steam_tonkAI(_Creature); 854 } 855 856 #define SPELL_TONK_MINE_DETONATE 25099 857 858 struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI 859 { 860 npc_tonk_mineAI(Creature *c) : ScriptedAI(c) 861 { 862 m_creature->SetAggressive(false); 863 Reset(); 864 } 865 866 uint32 ExplosionTimer; 867 868 void Reset() 869 { 870 ExplosionTimer = 3000; 871 } 872 873 void Aggro(Unit *who) {} 874 void AttackStart(Unit *who) {} 875 void MoveInLineOfSight(Unit *who) {} 876 877 void UpdateAI(const uint32 diff) 878 { 879 if (ExplosionTimer < diff) 880 { 881 m_creature->CastSpell(m_creature, SPELL_TONK_MINE_DETONATE, true); 882 m_creature->setDeathState(DEAD); // unsummon it 883 } else 884 ExplosionTimer -= diff; 885 } 886 }; 887 888 CreatureAI* GetAI_npc_tonk_mine(Creature *_Creature) 889 { 890 return new npc_tonk_mineAI(_Creature); 891 } 892 828 893 void AddSC_npcs_special() 829 894 { … … 876 941 newscript->pGossipSelect = &GossipSelect_npc_sayge; 877 942 newscript->RegisterSelf(); 878 } 943 944 newscript = new Script; 945 newscript->Name="npc_steam_tonk"; 946 newscript->GetAI = &GetAI_npc_steam_tonk; 947 newscript->RegisterSelf(); 948 949 newscript = new Script; 950 newscript->Name="npc_tonk_mine"; 951 newscript->GetAI = &GetAI_npc_tonk_mine; 952 newscript->RegisterSelf(); 953 } -
trunk/src/game/Creature.cpp
r283 r284 148 148 i_AI = NULL; 149 149 150 DeletePossessedAI(); 150 if (i_AI_possessed) 151 { 152 delete i_AI_possessed; 153 i_AI_possessed = NULL; 154 } 151 155 } 152 156 … … 563 567 } 564 568 565 void Creature::D eletePossessedAI()569 void Creature::DisablePossessedAI() 566 570 { 567 571 if (!i_AI_possessed) return; 568 569 delete i_AI_possessed;570 i_AI_possessed = NULL;571 572 572 573 // Signal the old AI that it's been re-enabled -
trunk/src/game/Creature.h
r283 r284 461 461 bool AIM_Initialize(); 462 462 void InitPossessedAI(); 463 void D eletePossessedAI();463 void DisablePossessedAI(); 464 464 465 465 void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); -
trunk/src/game/PetHandler.cpp
r283 r284 98 98 case COMMAND_ATTACK: //spellid=1792 //ATTACK 99 99 { 100 // Can't attack if owner is pacified 101 if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY)) 102 { 103 //pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED); 104 //TODO: Send proper error message to client 105 return; 106 } 100 107 // only place where pet can be player 101 108 pet->clearUnitState(UNIT_STAT_FOLLOW); -
trunk/src/game/Player.cpp
r283 r284 18957 18957 target->AddThreat(this, 1000000.0f); 18958 18958 } 18959 // D elete the assigned possessed AI18960 ((Creature*)target)->D eletePossessedAI();18959 // Disable the assigned possessed AI 18960 ((Creature*)target)->DisablePossessedAI(); 18961 18961 } 18962 18962 } -
trunk/src/game/PossessedAI.cpp
r283 r284 25 25 void PossessedAI::AttackStart(Unit *u) 26 26 { 27 if( !u )27 if( !u || i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 28 28 return; 29 29 … … 96 96 return; 97 97 } 98 else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady() )98 else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady() && !i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 99 99 { 100 100 i_pet.AttackerStateUpdate(i_pet.getVictim()); -
trunk/src/game/SharedDefines.h
r283 r284 2070 2070 SUMMON_TYPE_CRITTER3 = 307, 2071 2071 SUMMON_TYPE_UNKNOWN5 = 409, 2072 SUMMON_TYPE_ UNKNOWN2= 427,2072 SUMMON_TYPE_POSESSED3 = 427, 2073 2073 SUMMON_TYPE_POSESSED2 = 428 2074 2074 }; -
trunk/src/game/Spell.cpp
r283 r284 1534 1534 case TARGET_SCRIPT: 1535 1535 case TARGET_SCRIPT_COORDINATES: 1536 case TARGET_UNIT_AREA_SCRIPT: 1536 1537 { 1537 1538 SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); … … 3866 3867 case SUMMON_TYPE_POSESSED: 3867 3868 case SUMMON_TYPE_POSESSED2: 3869 case SUMMON_TYPE_POSESSED3: 3868 3870 case SUMMON_TYPE_DEMON: 3869 3871 case SUMMON_TYPE_SUMMON: -
trunk/src/game/SpellAuras.cpp
r283 r284 50 50 #include "GridNotifiersImpl.h" 51 51 #include "CellImpl.h" 52 #include "TemporarySummon.h"53 52 54 53 #define NULL_AURA_SLOT 0xFF … … 2025 2024 return; 2026 2025 } 2027 2028 // Eye of Kilrogg, unsummon eye when aura is gone2029 if(GetId() == 126 && caster->GetTypeId() == TYPEID_PLAYER && caster->GetCharm())2030 {2031 ((TemporarySummon*)caster->GetCharm())->UnSummon();2032 return;2033 }2034 2026 } 2035 2027 -
trunk/src/game/SpellEffects.cpp
r283 r284 3151 3151 case SUMMON_TYPE_POSESSED: 3152 3152 case SUMMON_TYPE_POSESSED2: 3153 case SUMMON_TYPE_POSESSED3: 3153 3154 EffectSummonPossessed(i); 3154 3155 break; … … 3175 3176 break; 3176 3177 case SUMMON_TYPE_UNKNOWN1: 3177 case SUMMON_TYPE_UNKNOWN2:3178 3178 case SUMMON_TYPE_UNKNOWN3: 3179 3179 case SUMMON_TYPE_UNKNOWN4: -
trunk/src/game/SpellHandler.cpp
r283 r284 34 34 #include "ScriptCalls.h" 35 35 #include "Totem.h" 36 #include "TemporarySummon.h" 36 37 37 38 void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) … … 377 378 return; 378 379 } 380 else if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && 381 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || 382 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || 383 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 384 { 385 // Possession is removed in the UnSummon function 386 ((TemporarySummon*)_player->GetCharm())->UnSummon(); 387 } 379 388 } 380 389 } -
trunk/src/game/Unit.cpp
r283 r284 47 47 #include "CellImpl.h" 48 48 #include "Path.h" 49 #include "TemporarySummon.h" 49 50 50 51 #include <math.h> … … 3412 3413 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 3413 3414 { 3415 // Unsummon any summoned as possessed creatures on channel interrupt 3416 SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo; 3417 for (int i = 0; i < 3; i++) 3418 { 3419 if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && 3420 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || 3421 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || 3422 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 3423 { 3424 // Possession is removed in the UnSummon function 3425 if (GetCharm()) 3426 ((TemporarySummon*)GetCharm())->UnSummon(); 3427 } 3428 } 3429 3414 3430 if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 3415 3431 m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); … … 9791 9807 9792 9808 CharmInfo::CharmInfo(Unit* unit) 9793 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) 9809 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false) 9794 9810 { 9795 9811 for(int i =0; i<4; ++i) … … 9802 9818 void CharmInfo::InitPetActionBar() 9803 9819 { 9820 if (m_barInit) 9821 return; 9822 9804 9823 // the first 3 SpellOrActions are attack, follow and stay 9805 9824 for(uint32 i = 0; i < 3; i++) … … 9816 9835 PetActionBar[i + 3].SpellOrAction = 0; 9817 9836 } 9818 } 9819 9820 void CharmInfo::InitEmptyActionBar() 9821 { 9822 for(uint32 x = 1; x < 10; ++x) 9837 m_barInit = true; 9838 } 9839 9840 void CharmInfo::InitEmptyActionBar(bool withAttack) 9841 { 9842 if (m_barInit) 9843 return; 9844 9845 for(uint32 x = 0; x < 10; ++x) 9823 9846 { 9824 9847 PetActionBar[x].Type = ACT_CAST; 9825 9848 PetActionBar[x].SpellOrAction = 0; 9826 9849 } 9827 PetActionBar[0].Type = ACT_COMMAND; 9828 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9850 if (withAttack) 9851 { 9852 PetActionBar[0].Type = ACT_COMMAND; 9853 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9854 } 9855 m_barInit = true; 9829 9856 } 9830 9857 -
trunk/src/game/Unit.h
r283 r284 641 641 typedef std::list<Player*> SharedVisionList; 642 642 643 struct CharmInfo643 struct TRINITY_DLL_SPEC CharmInfo 644 644 { 645 645 public: … … 658 658 void InitCharmCreateSpells(); 659 659 void InitPetActionBar(); 660 void InitEmptyActionBar( );660 void InitEmptyActionBar(bool withAttack = true); 661 661 //return true if successful 662 662 bool AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate = ACT_DECIDE); … … 672 672 ReactStates m_reactState; 673 673 uint32 m_petnumber; 674 bool m_barInit; 674 675 }; 675 676