void SwitchWeapons() { // CREDITS to Skyboat on ascentemu.com/forums he had some of this info on one of his releases switch (GetPhase()) { case 1: // Phase 1 (Default) SetDisplayWeaponIds(5192, 0); _unit->SetBaseAttackTime(MELEE, _unit->GetBaseAttackTime(MELEE)); // 1483 is taken from NCDB creature_proto break; case 2: // Phase 2 SetDisplayWeaponIds(5196, 5196); _unit->SetBaseAttackTime(MELEE, _unit->GetBaseAttackTime(MELEE) / 2); break; case 4: // Phase 4 // Is base attack time change needed if we use aura ? SetDisplayWeaponIds(7230, 0); _unit->SetBaseAttackTime(MELEE, _unit->GetBaseAttackTime(MELEE) * 2); ApplyAura(SMITES_HAMMER); break; } // Wait at the chest for 4.5seconds -- Still needs work _unit->setAttackTimer(4500, false); mWaitAtChest = AddTimer(4500); SetPhase(GetPhase() + 1); }
void SwitchWeapons() { switch ( GetPhase() ) { case 1: // Phase 1 (Default) SetDisplayWeaponIds( 5192, 0 ); _unit->SetUInt32Value( UNIT_FIELD_BASEATTACKTIME, _unit->GetUInt32Value( UNIT_FIELD_BASEATTACKTIME ) ); // 1483 is taken from NCDB creature_proto break; case 2: // Phase 2 SetDisplayWeaponIds( 5196, 5196 ); _unit->SetUInt32Value( UNIT_FIELD_BASEATTACKTIME, _unit->GetUInt32Value( UNIT_FIELD_BASEATTACKTIME ) / 2 ); break; case 4: // Phase 4 // Is base attack time change needed if we use aura ? SetDisplayWeaponIds( 7230, 0 ); _unit->SetUInt32Value( UNIT_FIELD_BASEATTACKTIME, _unit->GetUInt32Value( UNIT_FIELD_BASEATTACKTIME ) * 2 ); ApplyAura( SMITES_HAMMER ); break; }; // Wait at the chest for 4.5seconds -- Still needs work _unit->setAttackTimer( 4500, false ); mWaitAtChest = AddTimer( 4500 ); SetPhase( GetPhase() + 1 ); };
void ArcScriptCreatureAI::SetDisplayWeapon(bool pMainHand, bool pOffHand) { SetDisplayWeaponIds(pMainHand ? _unit->GetProto()->Item1SlotDisplay : 0, pMainHand ? _unit->GetProto()->Item1Info1 : 0, pMainHand ? _unit->GetProto()->Item1Info2 : 0, pOffHand ? _unit->GetProto()->Item2SlotDisplay : 0, pOffHand ? _unit->GetProto()->Item2Info1 : 0, pOffHand ? _unit->GetProto()->Item2Info2 : 0); }
void AIUpdate() { if( anchorGuid == 0 ) { CheckForAnchor(); if( anchorGuid != 0 ) { state = PHASE_INACTIVE; RemoveAIUpdateEvent(); return; } } if( state == PHASE_INACTIVE ) { _unit->SetStandState( uint8(STANDSTATE_STAND) ); _unit->RemoveAllAuras(); Player * plr = _unit->GetMapMgrPlayer( _unit->GetSummonedByGUID() ); if( plr ) SetFacingToObject( plr ); Creature * anchor = _unit->GetMapMgrCreature( anchorGuid ); if( anchor ) { anchor->SetChannelSpellTargetGUID( 0 ); anchor->SetChannelSpellId( 0 ); //anchor->GetCurrentSpell()->cancel(); } timer = AddTimer(1000); state = PHASE_STANDUP; } else if( state == PHASE_STANDUP && IsTimerFinished(timer) ) { _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You have committed a big mistake, demon"); timer = AddTimer(5000); state = PHASE_REACH_ARMORY; } else if( state == PHASE_REACH_ARMORY && IsTimerFinished(timer) ) { // test for nearest coords of armory uint32 nearest_entry = 0; uint32 nearest_distance = 1000; for(uint32 i = 0; i < sizeof(m_ArmoryLocations) / sizeof(Location); i++) { uint32 distance = _unit->CalcDistance(m_ArmoryLocations[i].x, m_ArmoryLocations[i].y, m_ArmoryLocations[i].z); if( distance < nearest_distance ) { nearest_distance = distance; nearest_entry = i; } } // now go to nearest armory MoveTo(m_ArmoryLocations[nearest_entry].x, m_ArmoryLocations[nearest_entry].y, m_ArmoryLocations[nearest_entry].z, true); timer = AddTimer(2000); state = PHASE_ACTIVATE; } else if( state == PHASE_ACTIVATE && IsTimerFinished(timer) ) { // face off the player Player * plr = _unit->GetMapMgrPlayer( _unit->GetSummonedByGUID() ); if( plr ) SetFacingToObject( plr ); // select suitable spell uint32 spell_to_cast = 0; for(uint32 i = 0; i < sizeof(m_DisplayToSpell) / sizeof(DisplayToSpell); i++) { if( m_DisplayToSpell[i].displayid == _unit->GetDisplayId() ) { spell_to_cast = m_DisplayToSpell[i].spellid; break; } } // change look _unit->CastSpell(_unit, spell_to_cast, false); _unit->CastSpell(_unit, 48266, false); // blood presence timer = AddTimer(2000); state = PHASE_ATTACK_PLAYER; // he equips same weapon as normal DK? SetDisplayWeaponIds(38707, 0); } else if( state == PHASE_ATTACK_PLAYER && IsTimerFinished(timer) ) { _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "And now you die!"); state = PHASE_ATTACKING; // we are fighting timer = AddTimer(1000); } else if( state == PHASE_ATTACKING && IsTimerFinished(timer) ) { _unit->SetFaction( 16 ); Player * plr = _unit->GetMapMgrPlayer( _unit->GetSummonedByGUID() ); if( plr ) { SetCanEnterCombat( true ); _unit->GetAIInterface()->AttackReaction( plr, 500, 0 ); _unit->GetAIInterface()->setNextTarget( plr ); _unit->GetAIInterface()->SetAIState(STATE_ATTACKING); _unit->GetAIInterface()->EventEnterCombat( plr, 0 ); } state = -1; //_unit->SetUInt32Value( UNIT_FIELD_FLAGS, 0 ); } ParentClass::AIUpdate(); }
void MoonScriptCreatureAI::SetDisplayWeapon(bool pMainHand, bool pOffHand) { SetDisplayWeaponIds(pMainHand ? _unit->GetProtoItemDisplayId(0) : 0, pOffHand ? _unit->GetProtoItemDisplayId(1) : 0); }