Exemplo n.º 1
0
void IsleOfConquest::HookOnUnitDied( Unit *victim ){
    if( victim->IsCreature() ){
        Creature *c = TO< Creature* >( victim );

        if( ( generals[ TEAM_ALLIANCE ] != NULL ) && ( c->GetEntry() == generals[ TEAM_ALLIANCE ]->GetEntry() ) ){
            Finish( TEAM_ALLIANCE );
            generals[ TEAM_ALLIANCE ] = NULL;
        }
        else
        if( ( generals[ TEAM_HORDE ] != NULL ) && ( c->GetEntry() == generals[ TEAM_HORDE ]->GetEntry() ) ){
            Finish( TEAM_HORDE );
            generals[ TEAM_HORDE  ] = NULL;

        }
        
        if( c->GetVehicleComponent() != NULL ){
            // Was it a workshop vehicle?
            for( uint32 i = 0; i < MAX_PLAYER_TEAMS; i++ ){
                if( ( workshopvehicle[ i ].c != NULL ) && ( c->GetGUID() == workshopvehicle[ i ].c->GetGUID() ) ){
                    workshopvehicle[ i ].c->Despawn( 1 * 1000, 0 );
                    workshopvehicle[ i ].c = NULL;
                }
            }

            for( uint32 i = 0; i < MAX_PLAYER_TEAMS; i++ ){
                for( uint32 j = 0; j < 4; j++ ){
                    if( ( workshopdemolisher[ i ][ j ].c != NULL ) && ( c->GetGUID() == workshopdemolisher[ i ][ j ].c->GetGUID() ) ){
                        workshopdemolisher[ i ][ j ].c->Despawn( 1* 1000, 0 );
                        workshopdemolisher[ i ][ j ].c = NULL;
                    }
                }
            }

            // Was it a dock vehicle?
            for( uint32 i = 0; i < MAX_PLAYER_TEAMS; i++ ){
                for( uint32 j = 0; j < 4; j++ ){
                    if( ( dockvehicle[ i ][ j ].c != NULL ) && ( c->GetGUID() == dockvehicle[ i ][ j ].c->GetGUID() ) ){
                        dockvehicle[ i ][ j ].c->Despawn( 1 * 1000, 0 );
                        dockvehicle[ i ][ j ].c = NULL;
                    }
                }
            }

            // If it was a workshop vehicle we need to rebuild it in 3 minutes
            ControlPointTypes state = controlpoint[ IOC_CONTROL_POINT_WORKSHOP ].state;
            if( ( ( state == IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED ) && ( workshopvehicle[ TEAM_ALLIANCE ].c == NULL ) ) ||
                ( ( state == IOC_SPAWN_TYPE_HORDE_CONTROLLED )    && ( workshopvehicle[ TEAM_HORDE ].c == NULL ) ) )
                BuildWorkshopVehicle( 3 * 60 * 1000 );
        }
    }
}
Exemplo n.º 2
0
void IsleOfConquest::EventWorkshopCaptured()
{
    ControlPointTypes state = controlpoint[IOC_CONTROL_POINT_WORKSHOP].state;

    switch (state)
    {
        case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:

            if (workshopvehicle[TEAM_HORDE].IsCloseToBaseLocation() && workshopvehicle[TEAM_HORDE].IsEmpty())
                workshopvehicle[TEAM_HORDE].Despawn();

            for (uint8 i = 0; i < 4; i++)
            {
                if (workshopdemolisher[TEAM_HORDE][i].IsCloseToBaseLocation() && workshopdemolisher[TEAM_HORDE][i].IsEmpty())
                    workshopdemolisher[TEAM_HORDE][i].Despawn();
            }

            for (uint8 i = 0; i < 4; i++)
            {
                workshopdemolisher[TEAM_ALLIANCE][i].baselocation = DemolisherLocations[i];
                workshopdemolisher[TEAM_ALLIANCE][i].c = SpawnCreature(34775, DemolisherLocations[i], 1);
            }
            break;

        case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
            if (workshopvehicle[TEAM_ALLIANCE].IsCloseToBaseLocation() && workshopvehicle[TEAM_ALLIANCE].IsEmpty())
                workshopvehicle[TEAM_ALLIANCE].Despawn();

            for (uint8 i = 0; i < 4; i++)
            {
                if (workshopdemolisher[TEAM_ALLIANCE][i].IsCloseToBaseLocation() && workshopdemolisher[TEAM_ALLIANCE][i].IsEmpty())
                    workshopdemolisher[TEAM_ALLIANCE][i].Despawn();
            }

            for (uint8 i = 0; i < 4; i++)
            {
                workshopdemolisher[TEAM_HORDE][i].baselocation = DemolisherLocations[i];
                workshopdemolisher[TEAM_HORDE][i].c = SpawnCreature(34775, DemolisherLocations[i], 2);
            }
            break;

        default:
            return;
            break;
    }

    BuildWorkshopVehicle(3 * 60 * 1000);
}