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