Core/Movement: properly set mover for possess/vehicles
This commit is contained in:
@@ -15849,6 +15849,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
|||||||
case CHARM_TYPE_VEHICLE:
|
case CHARM_TYPE_VEHICLE:
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||||
charmer->ToPlayer()->SetClientControl(this, 1);
|
charmer->ToPlayer()->SetClientControl(this, 1);
|
||||||
|
charmer->ToPlayer()->SetMover(this);
|
||||||
charmer->ToPlayer()->SetViewpoint(this, true);
|
charmer->ToPlayer()->SetViewpoint(this, true);
|
||||||
charmer->ToPlayer()->VehicleSpellInitialize();
|
charmer->ToPlayer()->VehicleSpellInitialize();
|
||||||
break;
|
break;
|
||||||
@@ -15857,6 +15858,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
|||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||||
charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
||||||
charmer->ToPlayer()->SetClientControl(this, 1);
|
charmer->ToPlayer()->SetClientControl(this, 1);
|
||||||
|
charmer->ToPlayer()->SetMover(this);
|
||||||
charmer->ToPlayer()->SetViewpoint(this, true);
|
charmer->ToPlayer()->SetViewpoint(this, true);
|
||||||
charmer->ToPlayer()->PossessSpellInitialize();
|
charmer->ToPlayer()->PossessSpellInitialize();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -359,7 +359,6 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
|||||||
{
|
{
|
||||||
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
|
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
unit->ToPlayer()->SetMover(this->GetBase());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_me->IsInWorld())
|
if (_me->IsInWorld())
|
||||||
@@ -411,10 +410,7 @@ void Vehicle::RemovePassenger(Unit* unit)
|
|||||||
unit->ClearUnitState(UNIT_STAT_ONVEHICLE);
|
unit->ClearUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
|
|
||||||
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
|
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
|
||||||
{
|
|
||||||
_me->RemoveCharmedBy(unit);
|
_me->RemoveCharmedBy(unit);
|
||||||
unit->ToPlayer()->SetMover(unit->ToPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_me->IsInWorld())
|
if (_me->IsInWorld())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3096,17 +3096,9 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
|
||||||
if (target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
|
|
||||||
caster->ToPlayer()->SetMover(target);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
target->RemoveCharmedBy(caster);
|
target->RemoveCharmedBy(caster);
|
||||||
caster->ToPlayer()->SetMover(caster);
|
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
target->ToPlayer()->SetMover(target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only one spell has this aura
|
// only one spell has this aura
|
||||||
@@ -3134,13 +3126,11 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
|
|||||||
if (caster->ToPlayer()->GetPet() != pet)
|
if (caster->ToPlayer()->GetPet() != pet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
|
pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
|
||||||
caster->ToPlayer()->SetMover(pet);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pet->RemoveCharmedBy(caster);
|
pet->RemoveCharmedBy(caster);
|
||||||
caster->ToPlayer()->SetMover(caster);
|
|
||||||
|
|
||||||
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
|
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
|
||||||
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user