mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
fix(Scripts/ScarletEnclave): City guards should throw stuff at new DKs (#22317)
This commit is contained in:
@@ -20083,6 +20083,24 @@ private:
|
||||
AuraType _auraType;
|
||||
};
|
||||
|
||||
class ResetToHomeOrientation : public BasicEvent
|
||||
{
|
||||
public:
|
||||
ResetToHomeOrientation(Creature& self) : _self(self) { }
|
||||
|
||||
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
|
||||
{
|
||||
if (_self.IsInWorld() && _self.FindMap() && _self.IsAlive() && !_self.IsInCombat())
|
||||
{
|
||||
_self.SetFacingTo(_self.GetHomePosition().GetOrientation());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
Creature& _self;
|
||||
};
|
||||
|
||||
void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex)
|
||||
{
|
||||
AuraEffect* aurEff = nullptr;
|
||||
@@ -20329,6 +20347,24 @@ void Unit::SetFacingToObject(WorldObject* object)
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
void Unit::SetTimedFacingToObject(WorldObject* object, uint32 time)
|
||||
{
|
||||
// never face when already moving
|
||||
if (!IsStopped() || !time)
|
||||
return;
|
||||
|
||||
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
|
||||
init.Launch();
|
||||
|
||||
if (Creature* c = ToCreature())
|
||||
c->m_Events.AddEvent(new ResetToHomeOrientation(*c), c->m_Events.CalculateTime(time));
|
||||
else
|
||||
LOG_ERROR("entities.unit", "Unit::SetTimedFacingToObject called on non-creature unit {}. This should never happen.", GetEntry());
|
||||
}
|
||||
|
||||
bool Unit::SetWalk(bool enable)
|
||||
{
|
||||
if (enable == IsWalking())
|
||||
|
||||
Reference in New Issue
Block a user