mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -788,9 +788,7 @@ void Creature::Update(uint32 diff)
|
||||
m_moveBackwardsMovementTime = urand(MOVE_BACKWARDS_CHECK_INTERVAL, MOVE_BACKWARDS_CHECK_INTERVAL * 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveBackwardsMovementTime -= diff;
|
||||
}
|
||||
|
||||
// Circling the target
|
||||
if (diff >= m_moveCircleMovementTime)
|
||||
@@ -799,9 +797,17 @@ void Creature::Update(uint32 diff)
|
||||
m_moveCircleMovementTime = urand(MOVE_CIRCLE_CHECK_INTERVAL, MOVE_CIRCLE_CHECK_INTERVAL * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveCircleMovementTime -= diff;
|
||||
|
||||
// Periodically check if able to move, if not, extend leash timer
|
||||
if (diff >= m_extendLeashTime)
|
||||
{
|
||||
if (!CanFreeMove())
|
||||
UpdateLeashExtensionTime();
|
||||
m_extendLeashTime = EXTEND_LEASH_CHECK_INTERVAL;
|
||||
}
|
||||
else
|
||||
m_extendLeashTime -= diff;
|
||||
}
|
||||
|
||||
// Call for assistance if not disabled
|
||||
|
||||
@@ -396,8 +396,10 @@ public:
|
||||
bool IsFreeToMove();
|
||||
static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL = 3000;
|
||||
static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL = 2000;
|
||||
static constexpr uint32 EXTEND_LEASH_CHECK_INTERVAL = 3000;
|
||||
uint32 m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL;
|
||||
uint32 m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL;
|
||||
uint32 m_extendLeashTime = EXTEND_LEASH_CHECK_INTERVAL;
|
||||
|
||||
[[nodiscard]] bool HasSwimmingFlagOutOfCombat() const
|
||||
{
|
||||
|
||||
@@ -13642,7 +13642,11 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill, getRace(), getClass());
|
||||
if (!rcEntry)
|
||||
{
|
||||
LOG_ERROR("entities.player", "Character {} has skill {} that does not exist.", GetGUID().ToString(), skill);
|
||||
LOG_ERROR("entities.player", "Player {} (GUID: {}), has skill ({}) that is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
|
||||
GetName(), GetGUID().GetCounter(), skill, getRace(), getClass());
|
||||
|
||||
// Mark skill for deletion in the database
|
||||
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(0, SKILL_DELETED)));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -13663,7 +13667,8 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
LOG_ERROR("entities.player", "Character {} has skill {} with value 0. Will be deleted.", GetGUID().ToString(), skill);
|
||||
LOG_ERROR("entities.player", "Player {} (GUID: {}), has skill ({}) with value 0. Will be deleted.",
|
||||
GetName(), GetGUID().GetCounter(), skill);
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL);
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ public:
|
||||
[[nodiscard]] uint32 GetCurrentTaxiPath() const;
|
||||
uint32 NextTaxiDestination()
|
||||
{
|
||||
if (m_TaxiDestinations.empty())
|
||||
return 0;
|
||||
|
||||
m_TaxiDestinations.pop_front();
|
||||
return GetTaxiDestination();
|
||||
}
|
||||
|
||||
@@ -20114,6 +20114,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;
|
||||
@@ -20360,6 +20378,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())
|
||||
|
||||
@@ -1894,6 +1894,7 @@ public:
|
||||
void SetInFront(WorldObject const* target);
|
||||
void SetFacingTo(float ori);
|
||||
void SetFacingToObject(WorldObject* object);
|
||||
void SetTimedFacingToObject(WorldObject* object, uint32 time); // Reset to home orientation after given time
|
||||
|
||||
bool isInAccessiblePlaceFor(Creature const* c) const;
|
||||
bool isInFrontInMap(Unit const* target, float distance, float arc = M_PI) const;
|
||||
|
||||
Reference in New Issue
Block a user