Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-06-03 23:16:28 +08:00
40 changed files with 555 additions and 243 deletions

View File

@@ -2176,6 +2176,9 @@ void Player::SetInWater(bool apply)
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
getHostileRefMgr().updateThreatTables();
if (InstanceScript* instance = GetInstanceScript())
instance->OnPlayerInWaterStateUpdate(this, apply);
}
bool Player::IsInAreaTriggerRadius(AreaTrigger const* trigger, float delta) const

View File

@@ -436,31 +436,27 @@ void Player::UpdateNextMailTimeAndUnreads()
{
// Update the next delivery time and unread mails
time_t cTime = GameTime::GetGameTime().count();
// Get the next delivery time
CharacterDatabasePreparedStatement* stmtNextDeliveryTime =
CharacterDatabase.GetPreparedStatement(CHAR_SEL_NEXT_MAIL_DELIVERYTIME);
stmtNextDeliveryTime->SetData(0, GetGUID().GetCounter());
stmtNextDeliveryTime->SetData(1, uint32(cTime));
PreparedQueryResult resultNextDeliveryTime =
CharacterDatabase.Query(stmtNextDeliveryTime);
if (resultNextDeliveryTime)
{
Field* fields = resultNextDeliveryTime->Fetch();
m_nextMailDelivereTime = time_t(fields[0].Get<uint32>());
}
// Get unread mails count
CharacterDatabasePreparedStatement* stmtUnreadAmount =
CharacterDatabase.GetPreparedStatement(
CHAR_SEL_CHARACTER_MAILCOUNT_UNREAD_SYNCH);
stmtUnreadAmount->SetData(0, GetGUID().GetCounter());
stmtUnreadAmount->SetData(1, uint32(cTime));
PreparedQueryResult resultUnreadAmount =
CharacterDatabase.Query(stmtUnreadAmount);
if (resultUnreadAmount)
m_nextMailDelivereTime = 0;
unReadMails = 0;
for (Mail const* mail : GetMails())
{
Field* fields = resultUnreadAmount->Fetch();
unReadMails = uint8(fields[0].Get<uint64>());
if (mail->deliver_time > cTime)
{
if (!m_nextMailDelivereTime || m_nextMailDelivereTime > mail->deliver_time)
m_nextMailDelivereTime = mail->deliver_time;
}
// must be not checked yet
if (mail->checked & MAIL_CHECK_MASK_READ)
continue;
// and already delivered or expired
if (cTime < mail->deliver_time || cTime > mail->expire_time)
continue;
unReadMails++;
}
}

View File

@@ -4223,7 +4223,7 @@ void Unit::ProcessTerrainStatusUpdate()
// remove appropriate auras if we are swimming/not swimming respectively
if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING)
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER);
else
else if (!isSwimming())
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
// liquid aura handling

View File

@@ -287,10 +287,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
if (pet->GetCharmerGUID() == GetPlayer()->GetGUID())
{
if (pet->IsSummon())
pet->ToTempSummon()->UnSummon();
else
_player->StopCastingCharm();
_player->StopCastingCharm();
}
else if (pet->GetOwnerGUID() == GetPlayer()->GetGUID())
{

View File

@@ -186,6 +186,9 @@ public:
virtual void OnPlayerAreaUpdate(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) {}
//Called when a player enters/leaves water bodies.
virtual void OnPlayerInWaterStateUpdate(Player* /*player*/, bool /*inWater*/) {}
//Handle open / close objects
//use HandleGameObject(ObjectGuid::Empty, boolen, GO); in OnObjectCreate in instance scripts
//use HandleGameObject(GUID, boolen, nullptr); in any other script

View File

@@ -110,3 +110,21 @@ bool BoundaryUnionBoundary::IsWithinBoundaryArea(Position const* pos) const
{
return (_b1->IsWithinBoundary(pos) || _b2->IsWithinBoundary(pos));
}
// ---== INTERSECT OF 2 BOUNDARIES ==---
BoundaryIntersectBoundary::BoundaryIntersectBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted) :
AreaBoundary(isInverted), _b1(b1), _b2(b2)
{
ASSERT(b1 && b2);
}
BoundaryIntersectBoundary::~BoundaryIntersectBoundary()
{
delete _b1;
delete _b2;
}
bool BoundaryIntersectBoundary::IsWithinBoundaryArea(Position const* pos) const
{
return (_b1->IsWithinBoundary(pos) && _b2->IsWithinBoundary(pos));
}

View File

@@ -165,4 +165,18 @@ class AC_GAME_API BoundaryUnionBoundary : public AreaBoundary
AreaBoundary const* const _b2;
};
class AC_GAME_API BoundaryIntersectBoundary : public AreaBoundary
{
public:
BoundaryIntersectBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted = false);
protected:
virtual ~BoundaryIntersectBoundary();
bool IsWithinBoundaryArea(Position const* pos) const override;
private:
AreaBoundary const* const _b1;
AreaBoundary const* const _b2;
};
#endif //ACORE_AREA_BOUNDARY_H