예제 #1
0
        void exposeHeart()
        {
            //Make untargetable
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE);
            me->SetReactState(REACT_PASSIVE);
            me->SetStandState(UNIT_STAND_STATE_SUBMERGED);
            me->AttackStop();

            //Summon the heart npc
            Creature* Heart = me->SummonCreature(NPC_XT002_HEART, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, TIMER_HEART_PHASE);
            if (Heart)
                Heart->EnterVehicle(me, 0);

            // Start "end of phase 2 timer"
            uiHeartPhaseTimer = TIMER_HEART_PHASE;

            //Phase 2 has offically started
            phase = 2;
            heart_exposed++;

            //Reset the add spawning timer
            uiSpawnAddTimer = TIMER_SPAWN_ADD;

            DoScriptText(SAY_HEART_OPENED, me);
            me->MonsterTextEmote(EMOTE_HEART, 0, true);
            me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
        }
예제 #2
0
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
{
    if(Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if(passenger->GetEntry() == entry)
            return;

        passenger->ExitVehicle(); // this should not happen
    }

    const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
    if(!cInfo)
        return;

    Creature *accessory;
    if(cInfo->VehicleId)
        accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
    else
        accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
    if(!accessory)
        return;

    accessory->EnterVehicle(this, seatId);
    // This is not good, we have to send update twice
    accessory->SendMovementFlagUpdate();
}
예제 #3
0
void Vehicle::InstallAllAccessories()
{
    if(!GetMap())
       return;

    CreatureDataAddon const *cainfo = GetCreatureAddon();
    if(!cainfo || !cainfo->passengers)
        return;
    for (CreatureDataAddonPassengers const* cPassanger = cainfo->passengers; cPassanger->seat_idx != -1; ++cPassanger)
    {
        // Continue if seat already taken
        if(GetPassenger(cPassanger->seat_idx))
            continue;

        uint32 guid = 0;
        bool isVehicle = false;
        // Set guid and check whatever it is
        if(cPassanger->guid != 0)
            guid = cPassanger->guid;
        else
        {
            CreatureDataAddon const* passAddon;
            passAddon = ObjectMgr::GetCreatureTemplateAddon(cPassanger->entry);
            if(passAddon && passAddon->vehicle_id != 0)
                isVehicle = true;
            else
                guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
        }
        // Create it
        Creature *pPassenger = new Creature;
        if(!isVehicle)
        {
            uint32 entry = cPassanger->entry;
            if(entry == 0)
            {
                CreatureData const* data = sObjectMgr.GetCreatureData(guid);
                if(!data)
                    continue;
                entry = data->id;
            }     
            
            if(!pPassenger->Create(guid, GetMap(), GetPhaseMask(), entry, 0))
                continue;
            pPassenger->LoadFromDB(guid, GetMap());
            pPassenger->Relocate(GetPositionX(), GetPositionY(), GetPositionZ());
            GetMap()->Add(pPassenger);
            pPassenger->AIM_Initialize();
        }
        else
            pPassenger = (Creature*)SummonVehicle(cPassanger->entry, GetPositionX(), GetPositionY(), GetPositionZ(), 0);
        // Enter vehicle...
        pPassenger->EnterVehicle(this, cPassanger->seat_idx, true);
        // ...and send update. Without this, client wont show this new creature/vehicle...
        WorldPacket data;
        pPassenger->BuildHeartBeatMsg(&data);
        pPassenger->SendMessageToSet(&data, false);
    }
}
 void EnterCombat(Unit* victim)
 {   
     DoCastAOE(SPELL_ABILITATE_BALANCE_BAR);
     if (instance)
     {
         instance->DoCastSpellOnPlayers(SPELL_ABILITATE_BALANCE_BAR);
         instance->SetData(DATA_RHYOLITH_EVENT, IN_PROGRESS);
     }
     direction = 25;
     phase1=true;
     steertimer = 0;
     me->SetReactState(REACT_PASSIVE);
     me->SendMovementWalkMode();
     moving = true;
     me->SetSpeed(MOVE_WALK,   0.5f, true);
     me->SetSpeed(MOVE_RUN,    0.5f, true);
     me->SetWalk(true);
     obsidian = me->AddAura(SPELL_OBSIDIAN_ARMOR, me); 
     if (obsidian)
         obsidian->SetStackAmount(80);
     DoZoneInCombat(me);
     leftfoot = me->SummonCreature(LEFT_FOOT_RHYOLITH,
         me->GetPositionX(),
         me->GetPositionY(),
         me->GetPositionZ() + 12.0f,
         0,TEMPSUMMON_MANUAL_DESPAWN);
     if (leftfoot)
     {
         leftfoot->EnterVehicle(me, 0);
         leftfoot->ClearUnitState(UNIT_STATE_ONVEHICLE);
     }
     rightfoot = me->SummonCreature(RIGHT_FOOT_RHYOLITH,
         me->GetPositionX(),
         me->GetPositionY(),
         me->GetPositionZ() + 12.0f,
         0,TEMPSUMMON_MANUAL_DESPAWN);
     if (rightfoot)
     {
         rightfoot->EnterVehicle(me, 1);
         rightfoot->ClearUnitState(UNIT_STATE_ONVEHICLE);
     }
     
     events.ScheduleEvent(EVENT_UPDATE_PATH, 2000, 0, 0);
     events.ScheduleEvent(EVENT_STOMP, 2000, 0, 0);
 }
예제 #5
0
 void MovementInform(uint32 /*type*/, uint32 id)
 {
     if (id == 1)
     {
         Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true);
         if (pContainer)
             pContainer->EnterVehicle(me);
     }
 }
예제 #6
0
        void UpdateAI(const uint32 diff)
        {
            if (!me->getVictim() && instance->GetBossState(TYPE_KOLOGARN) == NOT_STARTED)
                return;

            events.Update(diff);

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            switch (events.GetEvent())
            {
                case EVENT_MELEE_CHECK:
                    if (!me->IsWithinMeleeRange(me->getVictim()))
                        DoCast(SPELL_PETRIFY_BREATH);
                    events.RepeatEvent(1000);
                    break;
                case EVENT_SMASH:
                    if (uiArmCount == 2)
                        DoCastVictim(SPELL_TWO_ARM_SMASH);
                    else if (uiArmCount == 1)
                        DoCastVictim(SPELL_ONE_ARM_SMASH);
                    events.RepeatEvent(15000);
                    break;
                case EVENT_STONE_SHOUT:
                    DoCast(SPELL_STONE_SHOUT);
                    events.RepeatEvent(2000);
                    break;
                case EVENT_ENRAGE:
                    DoCast(SPELL_BERSERK);
                    DoScriptText(SAY_BERSERK, me);
                    break;
                case EVENT_RESPAWN_ARM:
                {
                    Creature* curArm = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_RIGHT_ARM) : 0);
                    if (!(curArm && curArm->isAlive()))
                        curArm = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_LEFT_ARM) : 0);
                    if (!(curArm && curArm->isAlive()))
                        break;

                    curArm->Respawn();
                    curArm->SetInCombatWithZone();
                    curArm->EnterVehicle(me);
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
예제 #7
0
파일: Level1.cpp 프로젝트: dberga/arcbliz
bool ChatHandler::HandleVehicleAddPassengerCommand(const char *args, WorldSession *session){
	std::stringstream ss( args );

	uint32 creature_entry;

	ss >> creature_entry;
	if( ss.fail() ){
		RedSystemMessage( session, "You need to specify a creature id." );
		return false;
	}

	if( session->GetPlayer()->GetTargetGUID() == 0 ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	Unit *u = session->GetPlayer()->GetMapMgr()->GetUnit( session->GetPlayer()->GetTargetGUID() );
	if( u == NULL ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	if( u->GetVehicleComponent() == NULL ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	if( !u->GetVehicleComponent()->HasEmptySeat() ){
		RedSystemMessage( session, "That vehicle has no more empty seats." );
		return false;
	}
	
	CreatureInfo  *ci = CreatureNameStorage.LookupEntry( creature_entry );
	CreatureProto *cp = CreatureProtoStorage.LookupEntry( creature_entry );

	if( ( ci == NULL ) || ( cp == NULL ) ){
		RedSystemMessage( session, "Creature %u doesn't exist in the database", creature_entry );
		return false;
	}
	
	Creature *c = u->GetMapMgr()->CreateCreature( creature_entry );
	c->Load( cp, u->GetPositionX(), u->GetPositionY(), u->GetPositionZ(), u->GetOrientation() );
	c->PushToWorld( u->GetMapMgr() );	
	c->EnterVehicle( u->GetGUID(), 1 );

	return true;
}
            void UpdateAI(uint32 diff)
            {
                if (timerSpawnPlate)
                {
                    timerSpawnPlate += diff;
                    if (timerSpawnPlate >= 1000)
                    {
                        if (Vehicle* table = me->GetVehicle())
                            if (Unit* plateHolder = table->GetPassenger(6))
                            {
                                SeatMap::const_iterator itr = table->GetSeatIteratorForPassenger(me);
                                if (itr == table->Seats.end())
                                    return;

                                uint8 vehicleSeatId = itr->first;
                                Creature* plate = me->SummonCreature(NPC_STRUDY_PLATE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f);
                                if (!plate)
                                    return;

                                plateGUID = plate->GetGUID();
                                plate->EnterVehicle(plateHolder, vehicleSeatId);
                                timerSpawnPlate = 0;
                                timerRotateChair = 1;
                            }
                    }
                }
                if (timerRotateChair)
                {
                    timerRotateChair += diff;
                    if (timerRotateChair >= 1000)
                    {
                        if (Creature* plate = GetPlate())
                            me->SetFacingToObject(plate);

                        timerRotateChair = 0;
                    }
                }
            }
예제 #9
0
 void WaypointReached(uint32 i)
 {
     Player* pPlayer = GetPlayerForEscort();
     if (!pPlayer)
         return;
     switch (i)
     {
         case 9:
             Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f);
             break;
         case 10:
             if (Mrfloppy)
             {
                 DoScriptText(SAY_WORGHAGGRO1, m_creature);
                 m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
             }
             break;
         case 11:
             Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
             break;
         case 17:
             Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
             DoScriptText(SAY_WORGRAGGRO3, m_creature);
             RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
             RWORG->setFaction(35);
             break;
         case 18:
             if (Mrfloppy)
             {
                 RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
                 DoCast(Mrfloppy,SPELL_MRFLOPPY);
             }
             break;
         case 19:
             if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
                 Mrfloppy->EnterVehicle(RWORG);
             break;
         case 20:
             if (Mrfloppy)
                 RWORG->HandleEmoteCommand(34);
             break;
         case 21:
             if (Mrfloppy)
             {
                 RWORG->Kill(Mrfloppy);
                 Mrfloppy->ExitVehicle();
                 RWORG->setFaction(14);
                 RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ());
                 DoScriptText(SAY_VICTORY2, m_creature);
             }
             break;
         case 22:
             if (Mrfloppy && Mrfloppy->isDead())
             {
                 RWORG->DisappearAndDie();
                 m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
                 Mrfloppy->setDeathState(ALIVE);
                 Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
                 DoScriptText(SAY_VICTORY3, m_creature);
             }
             break;
         case 24:
             if (pPlayer)
             {
                 Completed = true;
                 pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, m_creature);
                 DoScriptText(SAY_QUEST_COMPLETE, m_creature, pPlayer);
             }
             m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
             break;
         case 25:
             DoScriptText(SAY_VICTORY4, m_creature);
             break;
         case 27:
             m_creature->DisappearAndDie();
             if (Mrfloppy)
                 Mrfloppy->DisappearAndDie();
             break;
     }
 }