예제 #1
0
void Puppet::RemoveFromWorld() {
	if (!IsInWorld())
		return;

	RemoveCharmedBy(NULL);
	Minion::RemoveFromWorld();
}
예제 #2
0
void Vehicle::RemovePassenger(Unit *unit)
{
    if(unit->m_Vehicle != this)
        return;

    SeatMap::iterator seat;
    for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
        if(seat->second.passenger == unit)
            break;

    assert(seat != m_Seats.end());

    sLog.outDebug("Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), GetEntry(), m_vehicleInfo->m_ID, GetDBTableGUIDLow(), (int32)seat->first);

    seat->second.passenger = NULL;
    if(seat->second.seatInfo->IsUsable())
    {
        if(!m_usableSeatNum)
            SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
        ++m_usableSeatNum;
    }

    if(!(seat->second.seatInfo->m_flags & 0x4000))
        unit->clearUnitState(UNIT_STAT_ONVEHICLE);

    //SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);

    if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800)
        RemoveCharmedBy(unit);

    // only for flyable vehicles?
    //CastSpell(this, 45472, true);                           // Parachute
}